home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / src / gcc-257 / config / rs6000 / rs6000.md < prev    next >
Encoding:
Text File  |  1993-12-11  |  173.3 KB  |  5,519 lines

  1. ;;- Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
  2. ;;   Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
  3. ;;   Contributed by Richard Kenner (kenner@nyu.edu)
  4.  
  5. ;; This file is part of GNU CC.
  6.  
  7. ;; GNU CC is free software; you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation; either version 2, or (at your option)
  10. ;; any later version.
  11.  
  12. ;; GNU CC is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ;; GNU General Public License for more details.
  16.  
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU CC; see the file COPYING.  If not, write to
  19. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  22.  
  23. ;; Define an insn type attribute.  This is used in function unit delay
  24. ;; computations.
  25. (define_attr "type" "integer,load,fpload,imul,idiv,branch,compare,delayed_compare,fpcompare,mtlr,fp,dmul,sdiv,ddiv,ssqrt,dsqrt"
  26.   (const_string "integer"))
  27.  
  28. ;; Length (in bytes).
  29. (define_attr "length" ""
  30.   (if_then_else (eq_attr "type" "branch")
  31.         (if_then_else (and (ge (minus (pc) (match_dup 0))
  32.                        (const_int -32768))
  33.                    (lt (minus (pc) (match_dup 0))
  34.                        (const_int 32767)))
  35.                   (const_int 8)
  36.                   (const_int 12))
  37.         (const_int 4)))
  38.  
  39. ;; Processor type -- this attribute must exactly match the processor_type
  40. ;; enumeration in rs6000.h.
  41.  
  42. (define_attr "cpu" "rios1,rios2,ppc601,ppc603,ppc604,ppc620"
  43.   (const (symbol_ref "rs6000_cpu_attr")))
  44.  
  45. ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
  46. ;            TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
  47.  
  48. (define_function_unit "lsu" 1 0
  49.   (and (eq_attr "type" "load")
  50.        (eq_attr "cpu" "rios2,ppc603,ppc604,ppc620"))
  51.   2 0)
  52.  
  53. (define_function_unit "lsu" 1 0
  54.   (and (eq_attr "type" "fpload")
  55.        (eq_attr "cpu" "rios2,ppc603,ppc604,ppc620"))
  56.   2 0)
  57.  
  58. (define_function_unit "iu" 1 0
  59.   (and (eq_attr "type" "load")
  60.        (eq_attr "cpu" "rios1,ppc601"))
  61.   2 0)
  62.  
  63. (define_function_unit "iu" 1 0
  64.   (and (eq_attr "type" "fpload")
  65.        (eq_attr "cpu" "rios1,ppc601"))
  66.   3 0)
  67.  
  68. (define_function_unit "iu" 1 0
  69.   (and (eq_attr "type" "imul")
  70.        (eq_attr "cpu" "rios1"))
  71.   3 0)
  72.  
  73. (define_function_unit "iu" 1 0
  74.   (and (eq_attr "type" "imul")
  75.        (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
  76.   5 0)
  77.  
  78. (define_function_unit "iu" 1 0
  79.   (and (eq_attr "type" "idiv")
  80.        (eq_attr "cpu" "rios1"))
  81.   19 0)
  82.  
  83. (define_function_unit "iu" 1 0
  84.   (and (eq_attr "type" "idiv")
  85.        (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
  86.   36 0)
  87.  
  88. (define_function_unit "bpu" 1 0
  89.   (eq_attr "type" "compare")
  90.   4 0)
  91.  
  92. (define_function_unit "bpu" 1 0
  93.   (eq_attr "type" "delayed_compare")
  94.   5 0)
  95.  
  96. (define_function_unit "bpu" 1 0
  97.   (and (eq_attr "type" "fpcompare")
  98.        (eq_attr "cpu" "rios1,rios2"))
  99.   8 0)
  100.  
  101. (define_function_unit "bpu" 1 0
  102.   (and (eq_attr "type" "fpcompare")
  103.        (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
  104.   4 0)
  105.  
  106. (define_function_unit "bpu" 1 0
  107.   (and (eq_attr "type" "mtlr")
  108.        (eq_attr "cpu" "rios1,rios2"))
  109.   5 0)
  110.  
  111. (define_function_unit "bpu" 1 0
  112.   (and (eq_attr "type" "mtlr")
  113.        (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
  114.   4 0)
  115.  
  116. (define_function_unit "fpu" 1 0
  117.   (and (eq_attr "type" "fp")
  118.        (eq_attr "cpu" "rios1"))
  119.   2 0)
  120.  
  121. (define_function_unit "fpu" 1 0
  122.   (and (eq_attr "type" "fp")
  123.        (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
  124.   4 0)
  125.  
  126. (define_function_unit "fpu" 1 0
  127.   (and (eq_attr "type" "dmul")
  128.        (eq_attr "cpu" "rios1"))
  129.   2 0)
  130.  
  131. (define_function_unit "fpu" 1 0
  132.   (and (eq_attr "type" "dmul")
  133.        (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
  134.   5 0)
  135.  
  136. (define_function_unit "fpu" 1 0
  137.   (and (eq_attr "type" "sdiv")
  138.        (eq_attr "cpu" "rios1"))
  139.   19 0)
  140.  
  141. (define_function_unit "fpu" 1 0
  142.   (and (eq_attr "type" "sdiv")
  143.        (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
  144.   17 0)
  145.  
  146. (define_function_unit "fpu" 1 0
  147.   (and (eq_attr "type" "ddiv")
  148.        (eq_attr "cpu" "rios1"))
  149.   19 0)
  150.  
  151. (define_function_unit "fpu" 1 0
  152.   (and (eq_attr "type" "ddiv")
  153.        (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
  154.   31 0)
  155.  
  156. (define_function_unit "fpu" 1 0
  157.   (and (eq_attr "type" "ssqrt")
  158.        (eq_attr "cpu" "ppc603,ppc604,ppc620"))
  159.   31 0)
  160.  
  161. (define_function_unit "fpu" 1 0
  162.   (and (eq_attr "type" "dsqrt")
  163.        (eq_attr "cpu" "ppc603,ppc604,ppc620"))
  164.   31 0)
  165.  
  166. (define_function_unit "iu2" 2 0
  167.   (and (eq_attr "type" "integer")
  168.        (eq_attr "cpu" "rios2"))
  169.   1 0
  170.   [(eq_attr "type" "imul,idiv")])
  171.  
  172. (define_function_unit "imuldiv" 1 0
  173.   (and (eq_attr "type" "imul")
  174.        (eq_attr "cpu" "rios2"))
  175.   2 0
  176.   [(eq_attr "type" "integer")])
  177.  
  178. (define_function_unit "imuldiv" 1 0
  179.   (and (eq_attr "type" "idiv")
  180.        (eq_attr "cpu" "rios2"))
  181.   13 0
  182.   [(eq_attr "type" "integer")])
  183.  
  184. (define_function_unit "fpu2" 2 0
  185.   (and (eq_attr "type" "fp")
  186.        (eq_attr "cpu" "rios2"))
  187.   2 0)
  188.  
  189. (define_function_unit "fpu2" 2 0
  190.   (and (eq_attr "type" "dmul")
  191.        (eq_attr "cpu" "rios2"))
  192.   2 0)
  193.  
  194. (define_function_unit "fpu2" 2 0
  195.   (and (eq_attr "type" "sdiv")
  196.        (eq_attr "cpu" "rios2"))
  197.   17 0)
  198.  
  199. (define_function_unit "fpu2" 2 0
  200.   (and (eq_attr "type" "ddiv")
  201.        (eq_attr "cpu" "rios2"))
  202.   17 0)
  203.  
  204. (define_function_unit "fpu2" 2 0
  205.   (and (eq_attr "type" "ssqrt")
  206.        (eq_attr "cpu" "rios2"))
  207.   26 0)
  208.  
  209. (define_function_unit "fpu2" 2 0
  210.   (and (eq_attr "type" "dsqrt")
  211.        (eq_attr "cpu" "rios2"))
  212.   26 0)
  213.  
  214. ;; Start with fixed-point load and store insns.  Here we put only the more
  215. ;; complex forms.  Basic data transfer is done later.
  216.  
  217. (define_expand "zero_extendqisi2"
  218.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  219.     (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
  220.   ""
  221.   "")
  222.  
  223. (define_insn ""
  224.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  225.     (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
  226.   ""
  227.   "@
  228.    lbz%U1%X1 %0,%1
  229.    {rlinm|rlwinm} %0,%1,0,0xff"
  230.   [(set_attr "type" "load,*")])
  231.  
  232. (define_insn ""
  233.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  234.     (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
  235.             (const_int 0)))
  236.    (clobber (match_scratch:SI 2 "=r"))]
  237.   ""
  238.   "{andil.|andi.} %2,%1,0xff"
  239.   [(set_attr "type" "compare")])
  240.  
  241. (define_insn ""
  242.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  243.     (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
  244.             (const_int 0)))
  245.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  246.     (zero_extend:SI (match_dup 1)))]
  247.   ""
  248.   "{andil.|andi.} %0,%1,0xff"
  249.   [(set_attr "type" "compare")])
  250.  
  251. (define_expand "zero_extendqihi2"
  252.   [(set (match_operand:HI 0 "gpc_reg_operand" "")
  253.     (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
  254.   ""
  255.   "")
  256.  
  257. (define_insn ""
  258.   [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
  259.     (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
  260.   ""
  261.   "@
  262.    lbz%U1%X1 %0,%1
  263.    {rlinm|rlwinm} %0,%1,0,0xff"
  264.   [(set_attr "type" "load,*")])
  265.  
  266. (define_expand "zero_extendhisi2"
  267.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  268.     (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
  269.   ""
  270.   "")
  271.  
  272. (define_insn ""
  273.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  274.     (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
  275.   ""
  276.   "@
  277.    lhz%U1%X1 %0,%1
  278.    {rlinm|rlwinm} %0,%1,0,0xffff"
  279.   [(set_attr "type" "load,*")])
  280.  
  281. (define_insn ""
  282.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  283.     (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
  284.             (const_int 0)))
  285.    (clobber (match_scratch:SI 2 "=r"))]
  286.   ""
  287.   "{andil.|andi.} %2,%1,0xffff"
  288.   [(set_attr "type" "compare")])
  289.  
  290. (define_insn ""
  291.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  292.     (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
  293.             (const_int 0)))
  294.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  295.     (zero_extend:SI (match_dup 1)))]
  296.   ""
  297.   "{andil.|andi.} %0,%1,0xffff"
  298.   [(set_attr "type" "compare")])
  299.  
  300. (define_expand "extendhisi2"
  301.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  302.     (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
  303.   ""
  304.   "")
  305.  
  306. (define_insn ""
  307.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  308.     (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
  309.   ""
  310.   "@
  311.    lha%U1%X1 %0,%1
  312.    {exts|extsh} %0,%1"
  313.   [(set_attr "type" "load,*")])
  314.  
  315. (define_insn ""
  316.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  317.     (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
  318.             (const_int 0)))
  319.    (clobber (match_scratch:SI 2 "=r"))]
  320.   ""
  321.   "{exts.|extsh.} %2,%1"
  322.   [(set_attr "type" "compare")])
  323.  
  324. (define_insn ""
  325.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  326.     (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
  327.             (const_int 0)))
  328.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  329.     (sign_extend:SI (match_dup 1)))]
  330.   ""
  331.   "{exts.|extsh.} %0,%1"
  332.   [(set_attr "type" "compare")])
  333.  
  334. ;; Fixed-point arithmetic insns.
  335. (define_insn "addsi3"
  336.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  337.     (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b")
  338.          (match_operand:SI 2 "add_operand" "rI,J")))]
  339.   ""
  340.   "@
  341.    {a%I2|add%I2c} %0,%1,%2
  342.    {cau|addis} %0,%1,%u2")
  343.  
  344. (define_insn ""
  345.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  346.     (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  347.                  (match_operand:SI 2 "reg_or_short_operand" "rI"))
  348.             (const_int 0)))
  349.    (clobber (match_scratch:SI 3 "=r"))]
  350.   ""
  351.   "{a%I2.|add%I2c.} %3,%1,%2"
  352.   [(set_attr "type" "compare")])
  353.    
  354. (define_insn ""
  355.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  356.     (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  357.                  (match_operand:SI 2 "reg_or_short_operand" "rI"))
  358.             (const_int 0)))
  359.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  360.     (plus:SI (match_dup 1) (match_dup 2)))]
  361.   ""
  362.   "{a%I2.|add%I2c.} %0,%1,%2"
  363.   [(set_attr "type" "compare")])
  364.    
  365. ;; Split an add that we can't do in one insn into two insns, each of which
  366. ;; does one 16-bit part.  This is used by combine.  Note that the low-order
  367. ;; add should be last in case the result gets used in an address.
  368.  
  369. (define_split
  370.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  371.     (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
  372.          (match_operand:SI 2 "non_add_cint_operand" "")))]
  373.   ""
  374.   [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
  375.    (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
  376. "
  377. {
  378.   int low = INTVAL (operands[2]) & 0xffff;
  379.   int high = (unsigned) INTVAL (operands[2]) >> 16;
  380.  
  381.   if (low & 0x8000)
  382.     high++, low |= 0xffff0000;
  383.  
  384.   operands[3] = gen_rtx (CONST_INT, VOIDmode, high << 16);
  385.   operands[4] = gen_rtx (CONST_INT, VOIDmode, low);
  386. }")
  387.  
  388. (define_expand "one_cmplsi2"
  389.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  390.     (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
  391.   ""
  392.   "")
  393.  
  394. (define_insn ""
  395.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  396.     (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
  397.   "TARGET_POWER"
  398.   "{sfi|subfic} %0,%1,-1")
  399.  
  400. (define_insn ""
  401.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  402.     (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
  403.   "! TARGET_POWER"
  404.   "nor %0,%1,%1")
  405.  
  406. (define_insn ""
  407.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  408.     (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  409.             (const_int 0)))
  410.    (clobber (match_scratch:SI 2 "=r"))]
  411.   ""
  412.   "nor. %2,%1,%1"
  413.   [(set_attr "type" "compare")])
  414.  
  415. (define_insn ""
  416.   [(set (match_operand:CC 2 "cc_reg_operand" "=-x")
  417.     (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  418.             (const_int 0)))
  419.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  420.     (not:SI (match_dup 1)))]
  421.   ""
  422.   "nor. %0,%2,%1"
  423.   [(set_attr "type" "compare")])
  424.  
  425. (define_insn ""
  426.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  427.     (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
  428.           (match_operand:SI 2 "gpc_reg_operand" "r")))]
  429.   ""
  430.   "{sf%I1|subf%I1c} %0,%2,%1")
  431.  
  432. (define_insn ""
  433.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  434.     (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  435.                   (match_operand:SI 2 "gpc_reg_operand" "r"))
  436.             (const_int 0)))
  437.    (clobber (match_scratch:SI 3 "=r"))]
  438.   ""
  439.   "{sf.|subfc.} %3,%2,%1"
  440.   [(set_attr "type" "compare")])
  441.  
  442. (define_insn ""
  443.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  444.     (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  445.                   (match_operand:SI 2 "gpc_reg_operand" "r"))
  446.             (const_int 0)))
  447.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  448.     (minus:SI (match_dup 1) (match_dup 2)))]
  449.   ""
  450.   "{sf.|subfc.} %0,%2,%1"
  451.   [(set_attr "type" "compare")])
  452.  
  453. (define_expand "subsi3"
  454.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  455.     (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
  456.           (match_operand:SI 2 "reg_or_cint_operand" "")))]
  457.   ""
  458.   "
  459. {
  460.   if (GET_CODE (operands[2]) == CONST_INT)
  461.     {
  462.       emit_insn (gen_addsi3 (operands[0], operands[1],
  463.                  negate_rtx (SImode, operands[2])));
  464.       DONE;
  465.     }
  466. }")
  467.  
  468. ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
  469. ;; instruction and some auxiliary computations.  Then we just have a single
  470. ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
  471. ;; combine.
  472.  
  473. (define_expand "sminsi3"
  474.   [(set (match_dup 3)
  475.     (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
  476.                 (match_operand:SI 2 "reg_or_short_operand" ""))
  477.              (const_int 0)
  478.              (minus:SI (match_dup 2) (match_dup 1))))
  479.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  480.     (minus:SI (match_dup 2) (match_dup 3)))]
  481.   "TARGET_POWER"
  482.   "
  483. { operands[3] = gen_reg_rtx (SImode); }")
  484.  
  485. (define_split
  486.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  487.     (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
  488.          (match_operand:SI 2 "reg_or_short_operand" "")))
  489.    (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
  490.   "TARGET_POWER"
  491.   [(set (match_dup 3)
  492.     (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
  493.              (const_int 0)
  494.              (minus:SI (match_dup 2) (match_dup 1))))
  495.    (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
  496.   "")
  497.  
  498. (define_expand "smaxsi3"
  499.   [(set (match_dup 3)
  500.     (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
  501.                 (match_operand:SI 2 "reg_or_short_operand" ""))
  502.              (const_int 0)
  503.              (minus:SI (match_dup 2) (match_dup 1))))
  504.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  505.     (plus:SI (match_dup 3) (match_dup 1)))]
  506.   "TARGET_POWER"
  507.   "
  508. { operands[3] = gen_reg_rtx (SImode); }")
  509.  
  510. (define_split
  511.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  512.     (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
  513.          (match_operand:SI 2 "reg_or_short_operand" "")))
  514.    (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
  515.   "TARGET_POWER"
  516.   [(set (match_dup 3)
  517.     (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
  518.              (const_int 0)
  519.              (minus:SI (match_dup 2) (match_dup 1))))
  520.    (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
  521.   "")
  522.  
  523. (define_expand "uminsi3"
  524.   [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
  525.                   (const_int -2147483648)))
  526.    (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
  527.                   (const_int -2147483648)))
  528.    (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
  529.                        (const_int 0)
  530.                        (minus:SI (match_dup 4) (match_dup 3))))
  531.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  532.     (minus:SI (match_dup 2) (match_dup 3)))]
  533.   "TARGET_POWER"
  534.   "
  535. { operands[3] = gen_reg_rtx (SImode);  operands[4] = gen_reg_rtx (SImode); }")
  536.  
  537. (define_expand "umaxsi3"
  538.   [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
  539.                   (const_int -2147483648)))
  540.    (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
  541.                   (const_int -2147483648)))
  542.    (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
  543.                        (const_int 0)
  544.                        (minus:SI (match_dup 4) (match_dup 3))))
  545.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  546.     (plus:SI (match_dup 3) (match_dup 1)))]
  547.   "TARGET_POWER"
  548.   "
  549. { operands[3] = gen_reg_rtx (SImode);  operands[4] = gen_reg_rtx (SImode); }")
  550.  
  551. (define_insn ""
  552.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  553.     (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
  554.                  (match_operand:SI 2 "reg_or_short_operand" "rI"))
  555.              (const_int 0)
  556.              (minus:SI (match_dup 2) (match_dup 1))))]
  557.   "TARGET_POWER"
  558.   "doz%I2 %0,%1,%2")
  559.  
  560. (define_insn ""
  561.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  562.     (compare:CC
  563.      (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
  564.                   (match_operand:SI 2 "reg_or_short_operand" "rI"))
  565.               (const_int 0)
  566.               (minus:SI (match_dup 2) (match_dup 1)))
  567.      (const_int 0)))
  568.    (clobber (match_scratch:SI 3 "=r"))]
  569.   "TARGET_POWER"
  570.   "doz%I2. %3,%1,%2"
  571.   [(set_attr "type" "delayed_compare")])
  572.  
  573. (define_insn ""
  574.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  575.     (compare:CC
  576.      (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
  577.                   (match_operand:SI 2 "reg_or_short_operand" "rI"))
  578.               (const_int 0)
  579.               (minus:SI (match_dup 2) (match_dup 1)))
  580.      (const_int 0)))
  581.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  582.     (if_then_else:SI (gt (match_dup 1) (match_dup 2))
  583.              (const_int 0)
  584.              (minus:SI (match_dup 2) (match_dup 1))))]
  585.   "TARGET_POWER"
  586.   "doz%I2. %0,%1,%2"
  587.   [(set_attr "type" "delayed_compare")])
  588.  
  589. ;; We don't need abs with condition code because such comparisons should
  590. ;; never be done.
  591. (define_insn "abssi2"
  592.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  593.     (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
  594.   "TARGET_POWER"
  595.   "abs %0,%1")
  596.  
  597. (define_insn ""
  598.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  599.     (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
  600.   "TARGET_POWER"
  601.   "nabs %0,%1")
  602.  
  603. (define_insn "negsi2"
  604.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  605.     (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
  606.   ""
  607.   "neg %0,%1")
  608.  
  609. (define_insn ""
  610.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  611.     (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  612.             (const_int 0)))
  613.    (clobber (match_scratch:SI 2 "=r"))]
  614.   ""
  615.   "neg. %2,%1"
  616.   [(set_attr "type" "compare")])
  617.  
  618. (define_insn ""
  619.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  620.     (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  621.             (const_int 0)))
  622.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  623.     (neg:SI (match_dup 1)))]
  624.   ""
  625.   "neg. %0,%1"
  626.   [(set_attr "type" "compare")])
  627.  
  628. (define_insn "ffssi2"
  629.   [(set (match_operand:SI 0 "register_operand" "=&r")
  630.     (ffs:SI (match_operand:SI 1 "register_operand" "r")))]
  631.   ""
  632.   "neg %0,%1\;and %0,%0,%1\;{cntlz|cntlzw} %0,%0\;{sfi|subfic} %0,%0,32"
  633.   [(set_attr "length" "16")])
  634.  
  635. (define_expand "mulsi3"
  636.   [(use (match_operand:SI 0 "gpc_reg_operand" ""))
  637.    (use (match_operand:SI 1 "gpc_reg_operand" ""))
  638.    (use (match_operand:SI 2 "reg_or_short_operand" ""))]
  639.   ""
  640.   "
  641. {
  642.   if (TARGET_POWER)
  643.     emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
  644.   else
  645.     emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
  646.   DONE;
  647. }")
  648.  
  649. (define_insn "mulsi3_mq"
  650.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  651.     (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
  652.          (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  653.    (clobber (match_scratch:SI 3 "=q,q"))]
  654.   "TARGET_POWER"
  655.   "@
  656.    {muls|mullw} %0,%1,%2
  657.    {muli|mulli} %0,%1,%2"
  658.    [(set_attr "type" "imul")])
  659.  
  660. (define_insn "mulsi3_no_mq"
  661.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  662.     (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
  663.          (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
  664.   "! TARGET_POWER"
  665.   "@
  666.    mullw %0,%1,%2
  667.    mulli %0,%1,%2"
  668.    [(set_attr "type" "imul")])
  669.  
  670. (define_insn ""
  671.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  672.     (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  673.                  (match_operand:SI 2 "gpc_reg_operand" "r"))
  674.             (const_int 0)))
  675.    (clobber (match_scratch:SI 3 "=r"))
  676.    (clobber (match_scratch:SI 4 "=q"))]
  677.   "TARGET_POWER"
  678.   "{muls.|mullw.} %3,%1,%2"
  679.   [(set_attr "type" "delayed_compare")])
  680.  
  681. (define_insn ""
  682.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  683.     (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  684.                  (match_operand:SI 2 "gpc_reg_operand" "r"))
  685.             (const_int 0)))
  686.    (clobber (match_scratch:SI 3 "=r"))]
  687.   "! TARGET_POWER"
  688.   "mullw. %3,%1,%2"
  689.   [(set_attr "type" "delayed_compare")])
  690.  
  691. (define_insn ""
  692.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  693.     (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  694.                  (match_operand:SI 2 "gpc_reg_operand" "r"))
  695.             (const_int 0)))
  696.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  697.     (mult:SI (match_dup 1) (match_dup 2)))
  698.    (clobber (match_scratch:SI 4 "=q"))]
  699.   "TARGET_POWER"
  700.   "{muls.|mullw.} %0,%1,%2"
  701.   [(set_attr "type" "delayed_compare")])
  702.  
  703. (define_insn ""
  704.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  705.     (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  706.                  (match_operand:SI 2 "gpc_reg_operand" "r"))
  707.             (const_int 0)))
  708.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  709.     (mult:SI (match_dup 1) (match_dup 2)))]
  710.   "! TARGET_POWER"
  711.   "mullw. %0,%1,%2"
  712.   [(set_attr "type" "delayed_compare")])
  713.  
  714. ;; Operand 1 is divided by operand 2; quotient goes to operand
  715. ;; 0 and remainder to operand 3.
  716. ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
  717.  
  718. (define_insn "divmodsi4"
  719.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  720.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  721.         (match_operand:SI 2 "gpc_reg_operand" "r")))
  722.    (set (match_operand:SI 3 "gpc_reg_operand" "=q")
  723.     (mod:SI (match_dup 1) (match_dup 2)))]
  724.   "TARGET_POWER"
  725.   "divs %0,%1,%2"
  726.   [(set_attr "type" "idiv")])
  727.  
  728. (define_insn ""
  729.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  730.         (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  731.                 (match_operand:SI 2 "gpc_reg_operand" "r")))]
  732.   "TARGET_POWERPC"
  733.   "divw %0, %1, %2"
  734.   [(set_attr "type" "idiv")])
  735.  
  736. (define_insn "udivsi3"
  737.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  738.         (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  739.                  (match_operand:SI 2 "gpc_reg_operand" "r")))]
  740.   "TARGET_POWERPC"
  741.   "divwu %0, %1, %2"
  742.   [(set_attr "type" "idiv")])
  743.  
  744. ;; For powers of two we can do srai/aze for divide and then adjust for
  745. ;; modulus.  If it isn't a power of two, FAIL on POWER so divmodsi4 will be
  746. ;; used; for PowerPC, force operands into register and do a normal divide.
  747. (define_expand "divsi3"
  748.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  749.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
  750.         (match_operand:SI 2 "reg_or_cint_operand" "")))]
  751.   ""
  752.   "
  753. {
  754.   if (GET_CODE (operands[2]) == CONST_INT
  755.       && exact_log2 (INTVAL (operands[2])) >= 0)
  756.     ;
  757.  
  758.   else if (! TARGET_POWERPC)
  759.     FAIL;
  760.  
  761.   operands[2] = force_reg (SImode, operands[2]);
  762. }")
  763.  
  764. (define_expand "modsi3"
  765.   [(use (match_operand:SI 0 "gpc_reg_operand" ""))
  766.    (use (match_operand:SI 1 "gpc_reg_operand" ""))
  767.    (use (match_operand:SI 2 "const_int_operand" ""))]
  768.   ""
  769.   "
  770. {
  771.   int i = exact_log2 (INTVAL (operands[2]));
  772.   rtx temp1;
  773.   rtx temp2;
  774.  
  775.   if (i < 0)
  776.     FAIL;
  777.  
  778.   temp1 = gen_reg_rtx (SImode);
  779.   temp2 = gen_reg_rtx (SImode);
  780.  
  781.   emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
  782.   emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
  783.   emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
  784.   DONE;
  785.  
  786. }")
  787.  
  788. (define_insn ""
  789.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  790.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  791.         (match_operand:SI 2 "const_int_operand" "N")))]
  792.   "exact_log2 (INTVAL (operands[2])) >= 0"
  793.   "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
  794.   [(set_attr "length" "8")])
  795.  
  796. (define_insn ""
  797.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  798.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  799.         (match_operand:SI 2 "const_int_operand" "N")))
  800.    (clobber (match_scratch:SI 3 "=r"))]
  801.   "exact_log2 (INTVAL (operands[2])) >= 0"
  802.   "{srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3"
  803.   [(set_attr "type" "compare")
  804.    (set_attr "length" "8")])
  805.  
  806. (define_insn ""
  807.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  808.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  809.         (match_operand:SI 2 "const_int_operand" "N")))
  810.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  811.     (div:SI (match_dup 1) (match_dup 2)))]
  812.   "exact_log2 (INTVAL (operands[2])) >= 0"
  813.   "{srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0"
  814.   [(set_attr "type" "compare")
  815.    (set_attr "length" "8")])
  816.  
  817. (define_insn ""
  818.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  819.     (udiv:SI
  820.      (plus:DI (lshift:DI
  821.            (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
  822.            (const_int 32))
  823.           (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
  824.      (match_operand:SI 3 "gpc_reg_operand" "r")))
  825.    (set (match_operand:SI 2 "register_operand" "=*q")
  826.     (umod:SI
  827.      (plus:DI (lshift:DI
  828.            (zero_extend:DI (match_dup 1)) (const_int 32))
  829.           (zero_extend:DI (match_dup 4)))
  830.      (match_dup 3)))]
  831.   
  832.   "TARGET_POWER"
  833.   "div %0,%1,%3"
  834.   [(set_attr "type" "idiv")])
  835.  
  836. ;; To do unsigned divide we handle the cases of the divisor looking like a
  837. ;; negative number.  If it is a constant that is less than 2**31, we don't
  838. ;; have to worry about the branches.  So make a few subroutines here.
  839. ;;
  840. ;; First comes the normal case.
  841. (define_expand "udivmodsi4_normal"
  842.   [(set (match_dup 4) (const_int 0))
  843.    (parallel [(set (match_operand:SI 0 "" "")
  844.            (udiv:SI (plus:DI (lshift:DI (zero_extend:DI (match_dup 4))
  845.                         (const_int 32))
  846.                      (zero_extend:DI (match_operand:SI 1 "" "")))
  847.                 (match_operand:SI 2 "" "")))
  848.           (set (match_operand:SI 3 "" "")
  849.            (umod:SI (plus:DI (lshift:DI (zero_extend:DI (match_dup 4))
  850.                         (const_int 32))
  851.                      (zero_extend:DI (match_dup 1)))
  852.                 (match_dup 2)))])]
  853.   "TARGET_POWER"
  854.   "
  855. { operands[4] = gen_reg_rtx (SImode); }")
  856.  
  857. ;; This handles the branches.
  858. (define_expand "udivmodsi4_tests"
  859.   [(set (match_operand:SI 0 "" "") (const_int 0))
  860.    (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
  861.    (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
  862.    (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
  863.                (label_ref (match_operand:SI 4 "" "")) (pc)))
  864.    (set (match_dup 0) (const_int 1))
  865.    (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
  866.    (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
  867.    (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
  868.                (label_ref (match_dup 4)) (pc)))]
  869.   "TARGET_POWER"
  870.   "
  871. { operands[5] = gen_reg_rtx (CCUNSmode);
  872.   operands[6] = gen_reg_rtx (CCmode);
  873. }")
  874.  
  875. (define_expand "udivmodsi4"
  876.   [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
  877.            (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
  878.                 (match_operand:SI 2 "reg_or_cint_operand" "")))
  879.           (set (match_operand:SI 3 "gpc_reg_operand" "")
  880.            (umod:SI (match_dup 1) (match_dup 2)))])]
  881.   "TARGET_POWER"
  882.   "
  883. {
  884.   rtx label = 0;
  885.  
  886.   if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
  887.     {
  888.       operands[2] = force_reg (SImode, operands[2]);
  889.       label = gen_label_rtx ();
  890.       emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
  891.                   operands[3], label));
  892.     }
  893.   else
  894.     operands[2] = force_reg (SImode, operands[2]);
  895.  
  896.   emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
  897.                    operands[3]));
  898.   if (label)
  899.     emit_label (label);
  900.  
  901.   DONE;
  902. }")
  903.     
  904. (define_insn "andsi3"
  905.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
  906.     (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
  907.         (match_operand:SI 2 "and_operand" "?r,L,K,J")))
  908.    (clobber (match_scratch:CC 3 "=X,X,x,x"))]
  909.   ""
  910.   "@
  911.    and %0,%1,%2
  912.    {rlinm|rlwinm} %0,%1,0,%m2,%M2
  913.    {andil.|andi.} %0,%1,%b2
  914.    {andiu.|andis.} %0,%1,%u2")
  915.  
  916. (define_insn ""
  917.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
  918.     (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
  919.                 (match_operand:SI 2 "and_operand" "r,K,J,L"))
  920.             (const_int 0)))
  921.    (clobber (match_scratch:SI 3 "=r,r,r,r"))]
  922.   ""
  923.   "@
  924.    and. %3,%1,%2
  925.    {andil.|andi.} %3,%1,%b2
  926.    {andiu.|andis.} %3,%1,%u2
  927.    {rlinm.|rlwinm.} %3,%1,0,%m2,%M2"
  928.   [(set_attr "type" "compare,compare,compare,delayed_compare")])
  929.  
  930. (define_insn ""
  931.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x")
  932.     (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
  933.                 (match_operand:SI 2 "and_operand" "r,K,J,L"))
  934.             (const_int 0)))
  935.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
  936.     (and:SI (match_dup 1) (match_dup 2)))]
  937.   ""
  938.   "@
  939.    and. %0,%1,%2
  940.    {andil.|andi.} %0,%1,%b2
  941.    {andiu.|andis.} %0,%1,%u2
  942.    {rlinm.|rlwinm.} %0,%1,0,%m2,%M2"
  943.   [(set_attr "type" "compare,compare,compare,delayed_compare")])
  944.  
  945. ;; Take a AND with a constant that cannot be done in a single insn and try to
  946. ;; split it into two insns.  This does not verify that the insns are valid
  947. ;; since this need not be done as combine will do it.
  948.  
  949. (define_split
  950.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  951.     (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
  952.         (match_operand:SI 2 "non_and_cint_operand" "")))]
  953.   ""
  954.   [(set (match_dup 0) (and:SI (match_dup 1) (match_dup 3)))
  955.    (set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))]
  956.   "
  957. {
  958.   int maskval = INTVAL (operands[2]);
  959.   int i, transitions, last_bit_value;
  960.   int orig = maskval, first_c = maskval, second_c;
  961.  
  962.   /* We know that MASKVAL must have more than 2 bit-transitions.  Start at
  963.      the low-order bit and count for the third transition.  When we get there,
  964.      make a first mask that has everything to the left of that position
  965.      a one.  Then make the second mask to turn off whatever else is needed.  */
  966.  
  967.   for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
  968.     {
  969.       if (((maskval >>= 1) & 1) != last_bit_value)
  970.     last_bit_value ^= 1, transitions++;
  971.  
  972.       if (transitions > 2)
  973.     {
  974.       first_c |= (~0) << i;
  975.       break;
  976.     }
  977.     }
  978.  
  979.   second_c = orig | ~ first_c;
  980.  
  981.   operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
  982.   operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
  983. }")
  984.  
  985. (define_insn "iorsi3"
  986.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
  987.     (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
  988.         (match_operand:SI 2 "logical_operand" "r,K,J")))]
  989.   ""
  990.   "@
  991.    or %0,%1,%2
  992.    {oril|ori} %0,%1,%b2
  993.    {oriu|oris} %0,%1,%u2")
  994.  
  995. (define_insn ""
  996.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  997.     (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  998.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  999.             (const_int 0)))
  1000.    (clobber (match_scratch:SI 3 "=r"))]
  1001.   ""
  1002.   "or. %3,%1,%2"
  1003.   [(set_attr "type" "compare")])
  1004.  
  1005. (define_insn ""
  1006.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1007.     (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1008.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  1009.             (const_int 0)))
  1010.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1011.     (ior:SI (match_dup 1) (match_dup 2)))]
  1012.   ""
  1013.   "or. %0,%1,%2"
  1014.   [(set_attr "type" "compare")])
  1015.  
  1016. ;; Split an IOR that we can't do in one insn into two insns, each of which
  1017. ;; does one 16-bit part.  This is used by combine.
  1018.  
  1019. (define_split
  1020.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  1021.     (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
  1022.         (match_operand:SI 2 "non_logical_cint_operand" "")))]
  1023.   ""
  1024.   [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))
  1025.    (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 4)))]
  1026. "
  1027. {
  1028.   operands[3] = gen_rtx (CONST_INT, VOIDmode,
  1029.              INTVAL (operands[2]) & 0xffff0000);
  1030.   operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
  1031. }")
  1032.  
  1033. (define_insn "xorsi3"
  1034.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
  1035.     (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
  1036.         (match_operand:SI 2 "logical_operand" "r,K,J")))]
  1037.   ""
  1038.   "@
  1039.    xor %0,%1,%2
  1040.    {xoril|xori} %0,%1,%b2
  1041.    {xoriu|xoris} %0,%1,%u2")
  1042.  
  1043. (define_insn ""
  1044.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1045.     (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1046.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  1047.             (const_int 0)))
  1048.    (clobber (match_scratch:SI 3 "=r"))]
  1049.   ""
  1050.   "xor. %3,%1,%2"
  1051.   [(set_attr "type" "compare")])
  1052.  
  1053. (define_insn ""
  1054.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1055.     (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1056.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  1057.             (const_int 0)))
  1058.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1059.     (xor:SI (match_dup 1) (match_dup 2)))]
  1060.   ""
  1061.   "xor. %0,%1,%2"
  1062.   [(set_attr "type" "compare")])
  1063.  
  1064. ;; Split an XOR that we can't do in one insn into two insns, each of which
  1065. ;; does one 16-bit part.  This is used by combine.
  1066.  
  1067. (define_split
  1068.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  1069.     (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
  1070.         (match_operand:SI 2 "non_logical_cint_operand" "")))]
  1071.   ""
  1072.   [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 3)))
  1073.    (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))]
  1074. "
  1075. {
  1076.   operands[3] = gen_rtx (CONST_INT, VOIDmode,
  1077.              INTVAL (operands[2]) & 0xffff0000);
  1078.   operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
  1079. }")
  1080.  
  1081. (define_insn ""
  1082.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1083.     (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
  1084.             (match_operand:SI 2 "gpc_reg_operand" "r"))))]
  1085.    ""
  1086.    "eqv %0,%1,%2")
  1087.  
  1088. (define_insn ""
  1089.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1090.     (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
  1091.                     (match_operand:SI 2 "gpc_reg_operand" "r")))
  1092.             (const_int 0)))
  1093.    (clobber (match_scratch:SI 3 "=r"))]
  1094.    ""
  1095.    "eqv. %3,%1,%2"
  1096.    [(set_attr "type" "compare")])
  1097.  
  1098. (define_insn ""
  1099.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1100.     (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
  1101.                     (match_operand:SI 2 "gpc_reg_operand" "r")))
  1102.             (const_int 0)))
  1103.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1104.     (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
  1105.    ""
  1106.    "eqv. %0,%1,%2"
  1107.    [(set_attr "type" "compare")])
  1108.  
  1109. (define_insn ""
  1110.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1111.     (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1112.         (match_operand:SI 2 "gpc_reg_operand" "r")))]
  1113.   ""
  1114.   "andc %0,%2,%1")
  1115.  
  1116. (define_insn ""
  1117.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1118.     (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1119.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  1120.             (const_int 0)))
  1121.    (clobber (match_scratch:SI 3 "=r"))]
  1122.   ""
  1123.   "andc. %3,%2,%1"
  1124.   [(set_attr "type" "compare")])
  1125.  
  1126. (define_insn ""
  1127.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1128.     (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1129.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  1130.             (const_int 0)))
  1131.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1132.     (and:SI (not:SI (match_dup 1)) (match_dup 2)))]
  1133.   ""
  1134.   "andc. %0,%2,%1"
  1135.   [(set_attr "type" "compare")])
  1136.  
  1137. (define_insn ""
  1138.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1139.     (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1140.         (match_operand:SI 2 "gpc_reg_operand" "r")))]
  1141.   ""
  1142.   "orc %0,%2,%1")
  1143.  
  1144. (define_insn ""
  1145.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1146.     (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1147.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  1148.             (const_int 0)))
  1149.    (clobber (match_scratch:SI 3 "=r"))]
  1150.   ""
  1151.   "orc. %3,%2,%1"
  1152.   [(set_attr "type" "compare")])
  1153.  
  1154. (define_insn ""
  1155.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1156.     (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1157.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  1158.             (const_int 0)))
  1159.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1160.     (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
  1161.   ""
  1162.   "orc. %0,%2,%1"
  1163.   [(set_attr "type" "compare")])
  1164.  
  1165. (define_insn ""
  1166.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1167.     (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1168.         (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
  1169.   ""
  1170.   "nand %0,%1,%2")
  1171.  
  1172. (define_insn ""
  1173.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1174.     (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1175.                 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
  1176.             (const_int 0)))
  1177.    (clobber (match_scratch:SI 3 "=r"))]
  1178.   ""
  1179.   "nand. %3,%1,%2"
  1180.   [(set_attr "type" "compare")])
  1181.  
  1182. (define_insn ""
  1183.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1184.     (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1185.                 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
  1186.             (const_int 0)))
  1187.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1188.     (ior:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
  1189.   ""
  1190.   "nand. %0,%1,%2"
  1191.   [(set_attr "type" "compare")])
  1192.  
  1193. (define_insn ""
  1194.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1195.     (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1196.         (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
  1197.   ""
  1198.   "nor %0,%1,%2")
  1199.  
  1200. (define_insn ""
  1201.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1202.     (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1203.                 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
  1204.             (const_int 0)))
  1205.    (clobber (match_scratch:SI 3 "=r"))]
  1206.   ""
  1207.   "nor. %3,%1,%2"
  1208.   [(set_attr "type" "compare")])
  1209.  
  1210. (define_insn ""
  1211.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1212.     (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1213.                 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
  1214.             (const_int 0)))
  1215.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1216.     (and:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
  1217.   ""
  1218.   "nor. %0,%1,%2"
  1219.   [(set_attr "type" "compare")])
  1220.  
  1221. ;; maskir insn.  We need four forms because things might be in arbitrary
  1222. ;; orders.  Don't define forms that only set CR fields because these
  1223. ;; would modify an input register.
  1224.  
  1225. (define_insn ""
  1226.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1227.     (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
  1228.             (match_operand:SI 1 "gpc_reg_operand" "0"))
  1229.         (and:SI (match_dup 2)
  1230.             (match_operand:SI 3 "gpc_reg_operand" "r"))))]
  1231.   "TARGET_POWER"
  1232.   "maskir %0,%3,%2")
  1233.  
  1234. (define_insn ""
  1235.   [(set (match_operand:SI 0 "register_operand" "=r")
  1236.     (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
  1237.             (match_operand:SI 1 "gpc_reg_operand" "0"))
  1238.         (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
  1239.             (match_dup 2))))]
  1240.   "TARGET_POWER"
  1241.   "maskir %0,%3,%2")
  1242.  
  1243. (define_insn ""
  1244.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1245.     (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
  1246.             (match_operand:SI 3 "gpc_reg_operand" "r"))
  1247.         (and:SI (not:SI (match_dup 2))
  1248.             (match_operand:SI 1 "gpc_reg_operand" "0"))))]
  1249.   "TARGET_POWER"
  1250.   "maskir %0,%3,%2")
  1251.  
  1252. (define_insn ""
  1253.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1254.     (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
  1255.             (match_operand:SI 2 "gpc_reg_operand" "r"))
  1256.         (and:SI (not:SI (match_dup 2))
  1257.             (match_operand:SI 1 "gpc_reg_operand" "0"))))]
  1258.   "TARGET_POWER"
  1259.   "maskir %0,%3,%2")
  1260.  
  1261. (define_insn ""
  1262.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1263.     (compare:CC
  1264.      (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
  1265.              (match_operand:SI 1 "gpc_reg_operand" "0"))
  1266.          (and:SI (match_dup 2)
  1267.              (match_operand:SI 3 "gpc_reg_operand" "r")))
  1268.      (const_int 0)))
  1269.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1270.     (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
  1271.         (and:SI (match_dup 2) (match_dup 3))))]
  1272.   "TARGET_POWER"
  1273.   "maskir. %0,%3,%2"
  1274.   [(set_attr "type" "compare")])
  1275.  
  1276. (define_insn ""
  1277.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1278.     (compare:CC
  1279.      (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
  1280.              (match_operand:SI 1 "gpc_reg_operand" "0"))
  1281.          (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
  1282.              (match_dup 2)))
  1283.      (const_int 0)))
  1284.    (set (match_operand:SI 0 "register_operand" "=r")
  1285.     (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
  1286.         (and:SI (match_dup 3) (match_dup 2))))]
  1287.   "TARGET_POWER"
  1288.   "maskir. %0,%3,%2"
  1289.   [(set_attr "type" "compare")])
  1290.  
  1291. (define_insn ""
  1292.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1293.     (compare:CC
  1294.      (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
  1295.              (match_operand:SI 3 "gpc_reg_operand" "r"))
  1296.          (and:SI (not:SI (match_dup 2))
  1297.              (match_operand:SI 1 "gpc_reg_operand" "0")))
  1298.      (const_int 0)))
  1299.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1300.     (ior:SI (and:SI (match_dup 2) (match_dup 3))
  1301.         (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
  1302.   "TARGET_POWER"
  1303.   "maskir. %0,%3,%2"
  1304.   [(set_attr "type" "compare")])
  1305.  
  1306. (define_insn ""
  1307.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1308.     (compare:CC
  1309.      (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
  1310.              (match_operand:SI 2 "gpc_reg_operand" "r"))
  1311.          (and:SI (not:SI (match_dup 2))
  1312.              (match_operand:SI 1 "gpc_reg_operand" "0")))
  1313.      (const_int 0)))
  1314.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1315.     (ior:SI (and:SI (match_dup 3) (match_dup 2))
  1316.         (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
  1317.   "TARGET_POWER"
  1318.   "maskir. %0,%3,%2"
  1319.   [(set_attr "type" "compare")])
  1320.  
  1321. ;; Rotate and shift insns, in all their variants.  These support shifts,
  1322. ;; field inserts and extracts, and various combinations thereof.
  1323. (define_insn "insv"
  1324.   [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
  1325.              (match_operand:SI 1 "const_int_operand" "i")
  1326.              (match_operand:SI 2 "const_int_operand" "i"))
  1327.     (match_operand:SI 3 "gpc_reg_operand" "r"))]
  1328.   ""
  1329.   "*
  1330. {
  1331.   int start = INTVAL (operands[2]) & 31;
  1332.   int size = INTVAL (operands[1]) & 31;
  1333.  
  1334.   operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - start - size);
  1335.   operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
  1336.   return \"{rlimi|rlwimi} %0,%3,%4,%h2,%h1\";
  1337. }")
  1338.  
  1339. (define_insn "extzv"
  1340.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1341.     (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1342.              (match_operand:SI 2 "const_int_operand" "i")
  1343.              (match_operand:SI 3 "const_int_operand" "i")))]
  1344.   ""
  1345.   "*
  1346. {
  1347.   int start = INTVAL (operands[3]) & 31;
  1348.   int size = INTVAL (operands[2]) & 31;
  1349.  
  1350.   if (start + size >= 32)
  1351.     operands[3] = const0_rtx;
  1352.   else
  1353.     operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
  1354.   return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
  1355. }")
  1356.  
  1357. (define_insn ""
  1358.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1359.     (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1360.              (match_operand:SI 2 "const_int_operand" "i")
  1361.              (match_operand:SI 3 "const_int_operand" "i"))
  1362.             (const_int 0)))
  1363.    (clobber (match_scratch:SI 4 "=r"))]
  1364.   ""
  1365.   "*
  1366. {
  1367.   int start = INTVAL (operands[3]) & 31;
  1368.   int size = INTVAL (operands[2]) & 31;
  1369.  
  1370.   /* If the bitfield being tested fits in the upper or lower half of a
  1371.      word, it is possible to use andiu. or andil. to test it.  This is
  1372.      useful because the condition register set-use delay is smaller for
  1373.      andi[ul]. than for rlinm.  This doesn't work when the starting bit
  1374.      position is 0 because the LT and GT bits may be set wrong.  */
  1375.  
  1376.   if ((start > 0 && start + size <= 16) || start >= 16)
  1377.     {
  1378.       operands[3] = gen_rtx (CONST_INT, VOIDmode,
  1379.                  ((1 << (16 - (start & 15)))
  1380.                   - (1 << (16 - (start & 15) - size))));
  1381.       if (start < 16)
  1382.     return \"{andiu.|andis.} %4,%1,%3\";
  1383.       else
  1384.     return \"{andil.|andi.} %4,%1,%3\";
  1385.     }
  1386.   
  1387.   if (start + size >= 32)
  1388.     operands[3] = const0_rtx;
  1389.   else
  1390.     operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
  1391.   return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
  1392. }"
  1393.   [(set_attr "type" "compare")])
  1394.  
  1395. (define_insn ""
  1396.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1397.     (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1398.              (match_operand:SI 2 "const_int_operand" "i")
  1399.              (match_operand:SI 3 "const_int_operand" "i"))
  1400.             (const_int 0)))
  1401.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1402.     (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
  1403.   ""
  1404.   "*
  1405. {
  1406.   int start = INTVAL (operands[3]) & 31;
  1407.   int size = INTVAL (operands[2]) & 31;
  1408.  
  1409.   if (start >= 16 && start + size == 32)
  1410.     {
  1411.       operands[3] = gen_rtx (CONST_INT, VOIDmode, (1 << (32 - start)) - 1);
  1412.       return \"{andil.|andi.} %0,%1,%3\";
  1413.     }
  1414.   
  1415.   if (start + size >= 32)
  1416.     operands[3] = const0_rtx;
  1417.   else
  1418.     operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
  1419.   return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
  1420. }"
  1421.   [(set_attr "type" "delayed_compare")])
  1422.  
  1423. (define_insn "rotlsi3"
  1424.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1425.     (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1426.            (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
  1427.   ""
  1428.   "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
  1429.  
  1430. (define_insn ""
  1431.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1432.     (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1433.                    (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1434.             (const_int 0)))
  1435.    (clobber (match_scratch:SI 3 "=r"))]
  1436.   ""
  1437.   "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff"
  1438.   [(set_attr "type" "delayed_compare")])
  1439.  
  1440. (define_insn ""
  1441.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1442.     (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1443.                    (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1444.             (const_int 0)))
  1445.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1446.     (rotate:SI (match_dup 1) (match_dup 2)))]
  1447.   ""
  1448.   "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff"
  1449.   [(set_attr "type" "delayed_compare")])
  1450.  
  1451. (define_insn ""
  1452.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1453.     (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1454.                (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1455.         (match_operand:SI 3 "mask_operand" "L")))]
  1456.   ""
  1457.   "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
  1458.  
  1459. (define_insn ""
  1460.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1461.     (compare:CC (and:SI
  1462.              (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1463.                 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1464.              (match_operand:SI 3 "mask_operand" "L"))
  1465.             (const_int 0)))
  1466.    (clobber (match_scratch:SI 4 "=r"))]
  1467.   ""
  1468.   "{rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3"
  1469.   [(set_attr "type" "delayed_compare")])
  1470.  
  1471. (define_insn ""
  1472.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1473.     (compare:CC (and:SI
  1474.              (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1475.                 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1476.              (match_operand:SI 3 "mask_operand" "L"))
  1477.             (const_int 0)))
  1478.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1479.     (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
  1480.   ""
  1481.   "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3"
  1482.   [(set_attr "type" "delayed_compare")])
  1483.  
  1484. (define_insn ""
  1485.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1486.     (zero_extend:SI
  1487.      (subreg:QI
  1488.       (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1489.              (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
  1490.   ""
  1491.   "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
  1492.  
  1493. (define_insn ""
  1494.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1495.     (compare:CC (zero_extend:SI
  1496.              (subreg:QI
  1497.               (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1498.                  (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
  1499.             (const_int 0)))
  1500.    (clobber (match_scratch:SI 3 "=r"))]
  1501.   ""
  1502.   "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff"
  1503.   [(set_attr "type" "delayed_compare")])
  1504.  
  1505. (define_insn ""
  1506.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1507.     (compare:CC (zero_extend:SI
  1508.              (subreg:QI
  1509.               (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1510.                  (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
  1511.             (const_int 0)))
  1512.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1513.     (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
  1514.   ""
  1515.   "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff"
  1516.   [(set_attr "type" "delayed_compare")])
  1517.  
  1518. (define_insn ""
  1519.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1520.     (zero_extend:SI
  1521.      (subreg:HI
  1522.       (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1523.              (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
  1524.   ""
  1525.   "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
  1526.  
  1527. (define_insn ""
  1528.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1529.     (compare:CC (zero_extend:SI
  1530.              (subreg:HI
  1531.               (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1532.                  (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
  1533.             (const_int 0)))
  1534.    (clobber (match_scratch:SI 3 "=r"))]
  1535.   ""
  1536.   "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff"
  1537.   [(set_attr "type" "delayed_compare")])
  1538.  
  1539. (define_insn ""
  1540.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1541.     (compare:CC (zero_extend:SI
  1542.              (subreg:HI
  1543.               (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1544.                  (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
  1545.             (const_int 0)))
  1546.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1547.     (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
  1548.   ""
  1549.   "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff"
  1550.   [(set_attr "type" "delayed_compare")])
  1551.  
  1552. ;; Note that we use "sle." instead of "sl." so that we can set
  1553. ;; SHIFT_COUNT_TRUNCATED.
  1554.  
  1555. (define_expand "ashlsi3"
  1556.   [(use (match_operand:SI 0 "gpc_reg_operand" ""))
  1557.    (use (match_operand:SI 1 "gpc_reg_operand" ""))
  1558.    (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
  1559.   ""
  1560.   "
  1561. {
  1562.   if (TARGET_POWER)
  1563.     emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
  1564.   else
  1565.     emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
  1566.   DONE;
  1567. }")
  1568.  
  1569. (define_insn "ashlsi3_power"
  1570.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1571.     (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1572.            (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
  1573.    (clobber (match_scratch:SI 3 "=q,X"))]
  1574.   "TARGET_POWER"
  1575.   "@
  1576.    sle %0,%1,%2
  1577.    {sli|slwi} %0,%1,%h2"
  1578.   [(set_attr "length" "8")])
  1579.  
  1580. (define_insn "ashlsi3_no_power"
  1581.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1582.     (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1583.            (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
  1584.   "! TARGET_POWER"
  1585.   "slw%I2 %0,%1,%2"
  1586.   [(set_attr "length" "8")])
  1587.  
  1588. (define_insn ""
  1589.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  1590.     (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1591.                    (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1592.             (const_int 0)))
  1593.    (clobber (match_scratch:SI 3 "=r,r"))
  1594.    (clobber (match_scratch:SI 4 "=q,X"))]
  1595.   "TARGET_POWER"
  1596.   "@
  1597.    sle. %3,%1,%2
  1598.    {sli.|slwi.} %3,%1,%h2"
  1599.   [(set_attr "type" "delayed_compare")])
  1600.  
  1601. (define_insn ""
  1602.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1603.     (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1604.                    (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1605.             (const_int 0)))
  1606.    (clobber (match_scratch:SI 3 "=r"))]
  1607.   "TARGET_POWERPC"
  1608.   "slw%I2. %3,%1,%2"
  1609.   [(set_attr "type" "delayed_compare")])
  1610.  
  1611. (define_insn ""
  1612.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
  1613.     (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1614.                    (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1615.             (const_int 0)))
  1616.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1617.     (ashift:SI (match_dup 1) (match_dup 2)))
  1618.    (clobber (match_scratch:SI 4 "=q,X"))]
  1619.   "TARGET_POWER"
  1620.   "@
  1621.    sle. %0,%1,%2
  1622.    {sli.|slwi.} %0,%1,%h2"
  1623.   [(set_attr "type" "delayed_compare")])
  1624.  
  1625. (define_insn ""
  1626.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1627.     (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1628.                    (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1629.             (const_int 0)))
  1630.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1631.     (ashift:SI (match_dup 1) (match_dup 2)))]
  1632.   "TARGET_POWERPC"
  1633.   "slw%I2. %0,%1,%2"
  1634.   [(set_attr "type" "delayed_compare")])
  1635.  
  1636. (define_insn ""
  1637.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1638.     (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1639.                (match_operand:SI 2 "const_int_operand" "i"))
  1640.         (match_operand:SI 3 "mask_operand" "L")))]
  1641.   "includes_lshift_p (operands[2], operands[3])"
  1642.   "{rlinm|rlwinm} %0,%h1,%h2,%m3,%M3")
  1643.  
  1644. (define_insn ""
  1645.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1646.     (compare:CC
  1647.      (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1648.                 (match_operand:SI 2 "const_int_operand" "i"))
  1649.          (match_operand:SI 3 "mask_operand" "L"))
  1650.      (const_int 0)))
  1651.    (clobber (match_scratch:SI 4 "=r"))]
  1652.   "includes_lshift_p (operands[2], operands[3])"
  1653.   "{rlinm.|rlwinm.} %4,%h1,%h2,%m3,%M3"
  1654.   [(set_attr "type" "delayed_compare")])
  1655.  
  1656. (define_insn ""
  1657.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1658.     (compare:CC
  1659.      (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1660.                 (match_operand:SI 2 "const_int_operand" "i"))
  1661.          (match_operand:SI 3 "mask_operand" "L"))
  1662.      (const_int 0)))
  1663.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1664.     (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
  1665.   "includes_lshift_p (operands[2], operands[3])"
  1666.   "{rlinm.|rlwinm.} %0,%h1,%h2,%m3,%M3"
  1667.   [(set_attr "type" "delayed_compare")])
  1668.  
  1669. ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
  1670. ;; "sli x,x,0".
  1671. (define_expand "lshrsi3"
  1672.   [(use (match_operand:SI 0 "gpc_reg_operand" ""))
  1673.    (use (match_operand:SI 1 "gpc_reg_operand" ""))
  1674.    (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
  1675.   ""
  1676.   "
  1677. {
  1678.   if (TARGET_POWER)
  1679.     emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
  1680.   else
  1681.     emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
  1682.   DONE;
  1683. }")
  1684.  
  1685. (define_insn "lshrsi3_power"
  1686.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1687.     (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1688.              (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
  1689.    (clobber (match_scratch:SI 3 "=q,X"))]
  1690.   "TARGET_POWER"
  1691.   "@
  1692.   sre %0,%1,%2
  1693.   {s%A2i|s%A2wi} %0,%1,%h2")
  1694.  
  1695. (define_insn "lshrsi3_no_power"
  1696.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1697.     (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1698.              (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
  1699.   "! TARGET_POWER"
  1700.   "srw%I2 %0,%1,%2")
  1701.  
  1702. (define_insn ""
  1703.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  1704.     (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1705.                  (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1706.             (const_int 0)))
  1707.    (clobber (match_scratch:SI 3 "=r,r"))
  1708.    (clobber (match_scratch:SI 4 "=q,X"))]
  1709.   "TARGET_POWER"
  1710.   "@
  1711.   sre. %3,%1,%2
  1712.   {s%A2i.|s%A2wi.} %3,%1,%h2"
  1713.   [(set_attr "type" "delayed_compare")])
  1714.  
  1715. (define_insn ""
  1716.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1717.     (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1718.                  (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1719.             (const_int 0)))
  1720.    (clobber (match_scratch:SI 3 "=r"))]
  1721.   "! TARGET_POWER"
  1722.   "srw%I2. %3,%1,%2"
  1723.   [(set_attr "type" "delayed_compare")])
  1724.  
  1725. (define_insn ""
  1726.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
  1727.     (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1728.                  (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1729.             (const_int 0)))
  1730.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1731.     (lshiftrt:SI (match_dup 1) (match_dup 2)))
  1732.    (clobber (match_scratch:SI 4 "=q,X"))]
  1733.   "TARGET_POWER"
  1734.   "@
  1735.   sre. %0,%1,%2
  1736.   {s%A2i.|s%A2wi.} %0,%1,%h2"
  1737.   [(set_attr "type" "delayed_compare")])
  1738.  
  1739. (define_insn ""
  1740.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1741.     (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1742.                  (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1743.             (const_int 0)))
  1744.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1745.     (lshiftrt:SI (match_dup 1) (match_dup 2)))]
  1746.   "! TARGET_POWER"
  1747.   "srw%I2. %0,%1,%2"
  1748.   [(set_attr "type" "delayed_compare")])
  1749.  
  1750. (define_insn ""
  1751.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1752.     (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1753.                  (match_operand:SI 2 "const_int_operand" "i"))
  1754.         (match_operand:SI 3 "mask_operand" "L")))]
  1755.   "includes_rshift_p (operands[2], operands[3])"
  1756.   "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
  1757.  
  1758. (define_insn ""
  1759.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1760.     (compare:CC
  1761.      (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1762.                   (match_operand:SI 2 "const_int_operand" "i"))
  1763.          (match_operand:SI 3 "mask_operand" "L"))
  1764.      (const_int 0)))
  1765.    (clobber (match_scratch:SI 4 "=r"))]
  1766.   "includes_rshift_p (operands[2], operands[3])"
  1767.   "{rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3"
  1768.   [(set_attr "type" "delayed_compare")])
  1769.  
  1770. (define_insn ""
  1771.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1772.     (compare:CC
  1773.      (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1774.                   (match_operand:SI 2 "const_int_operand" "i"))
  1775.          (match_operand:SI 3 "mask_operand" "L"))
  1776.      (const_int 0)))
  1777.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1778.     (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
  1779.   "includes_rshift_p (operands[2], operands[3])"
  1780.   "{rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3"
  1781.   [(set_attr "type" "delayed_compare")])
  1782.  
  1783. (define_insn ""
  1784.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1785.     (zero_extend:SI
  1786.      (subreg:QI
  1787.       (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1788.                (match_operand:SI 2 "const_int_operand" "i")) 0)))]
  1789.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
  1790.   "{rlinm|rlwinm} %0,%1,%s2,0xff")
  1791.  
  1792. (define_insn ""
  1793.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1794.     (compare:CC
  1795.      (zero_extend:SI
  1796.       (subreg:QI
  1797.        (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1798.             (match_operand:SI 2 "const_int_operand" "i")) 0))
  1799.      (const_int 0)))
  1800.    (clobber (match_scratch:SI 3 "=r"))]
  1801.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
  1802.   "{rlinm.|rlwinm.} %3,%1,%s2,0xff"
  1803.   [(set_attr "type" "delayed_compare")])
  1804.  
  1805. (define_insn ""
  1806.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1807.     (compare:CC
  1808.      (zero_extend:SI
  1809.       (subreg:QI
  1810.        (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1811.             (match_operand:SI 2 "const_int_operand" "i")) 0))
  1812.      (const_int 0)))
  1813.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1814.     (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
  1815.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
  1816.   "{rlinm.|rlwinm.} %0,%1,%s2,0xff"
  1817.   [(set_attr "type" "delayed_compare")])
  1818.  
  1819. (define_insn ""
  1820.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1821.     (zero_extend:SI
  1822.      (subreg:HI
  1823.       (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1824.                (match_operand:SI 2 "const_int_operand" "i")) 0)))]
  1825.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
  1826.   "{rlinm|rlwinm} %0,%1,%s2,0xffff")
  1827.  
  1828. (define_insn ""
  1829.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1830.     (compare:CC
  1831.      (zero_extend:SI
  1832.       (subreg:HI
  1833.        (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1834.             (match_operand:SI 2 "const_int_operand" "i")) 0))
  1835.      (const_int 0)))
  1836.    (clobber (match_scratch:SI 3 "=r"))]
  1837.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
  1838.   "{rlinm.|rlwinm.} %3,%1,%s2,0xffff"
  1839.   [(set_attr "type" "delayed_compare")])
  1840.  
  1841. (define_insn ""
  1842.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1843.     (compare:CC
  1844.      (zero_extend:SI
  1845.       (subreg:HI
  1846.        (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1847.             (match_operand:SI 2 "const_int_operand" "i")) 0))
  1848.      (const_int 0)))
  1849.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1850.     (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
  1851.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
  1852.   "{rlinm.|rlwinm.} %0,%1,%s2,0xffff"
  1853.   [(set_attr "type" "delayed_compare")])
  1854.  
  1855. (define_insn ""
  1856.   [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
  1857.              (const_int 1)
  1858.              (match_operand:SI 1 "gpc_reg_operand" "r"))
  1859.     (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
  1860.              (const_int 31)))]
  1861.   "TARGET_POWER"
  1862.   "rrib %0,%1,%2")
  1863.  
  1864. (define_insn ""
  1865.   [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
  1866.              (const_int 1)
  1867.              (match_operand:SI 1 "gpc_reg_operand" "r"))
  1868.     (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
  1869.              (const_int 31)))]
  1870.   "TARGET_POWER"
  1871.   "rrib %0,%1,%2")
  1872.  
  1873. (define_insn ""
  1874.   [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
  1875.              (const_int 1)
  1876.              (match_operand:SI 1 "gpc_reg_operand" "r"))
  1877.     (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
  1878.              (const_int 1)
  1879.              (const_int 0)))]
  1880.   "TARGET_POWER"
  1881.   "rrib %0,%1,%2")
  1882.  
  1883. (define_expand "ashrsi3"
  1884.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  1885.     (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
  1886.              (match_operand:SI 2 "reg_or_cint_operand" "")))]
  1887.   ""
  1888.   "
  1889. {
  1890.   if (TARGET_POWER)
  1891.     emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
  1892.   else
  1893.     emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
  1894.   DONE;
  1895. }")
  1896.  
  1897. (define_insn "ashrsi3_power"
  1898.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1899.     (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1900.              (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
  1901.    (clobber (match_scratch:SI 3 "=q,X"))]
  1902.   "TARGET_POWER"
  1903.   "@
  1904.    srea %0,%1,%2
  1905.    {srai|srawi} %0,%1,%h2")
  1906.  
  1907. (define_insn "ashrsi3_no_power"
  1908.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1909.     (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1910.              (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
  1911.   "! TARGET_POWER"
  1912.   "sraw%I2 %0,%1,%2")
  1913.  
  1914. (define_insn ""
  1915.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  1916.     (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1917.                  (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1918.             (const_int 0)))
  1919.    (clobber (match_scratch:SI 3 "=r,r"))
  1920.    (clobber (match_scratch:SI 4 "=q,X"))]
  1921.   "TARGET_POWER"
  1922.   "@
  1923.    srea. %3,%1,%2
  1924.    {srai.|srawi.} %3,%1,%h2"
  1925.   [(set_attr "type" "delayed_compare")])
  1926.  
  1927. (define_insn ""
  1928.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1929.     (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1930.                  (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1931.             (const_int 0)))
  1932.    (clobber (match_scratch:SI 3 "=r"))]
  1933.   "! TARGET_POWER"
  1934.   "sraw%I2. %3,%1,%2"
  1935.   [(set_attr "type" "delayed_compare")])
  1936.  
  1937. (define_insn ""
  1938.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
  1939.     (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1940.                  (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1941.             (const_int 0)))
  1942.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1943.     (ashiftrt:SI (match_dup 1) (match_dup 2)))
  1944.    (clobber (match_scratch:SI 4 "=q,X"))]
  1945.   "TARGET_POWER"
  1946.   "@
  1947.    srea. %0,%1,%2
  1948.    {srai.|srawi.} %0,%1,%h2"
  1949.   [(set_attr "type" "delayed_compare")])
  1950.  
  1951. (define_insn ""
  1952.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1953.     (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1954.                  (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1955.             (const_int 0)))
  1956.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1957.     (ashiftrt:SI (match_dup 1) (match_dup 2)))]
  1958.   "! TARGET_POWER"
  1959.   "sraw%I2. %0,%1,%2"
  1960.   [(set_attr "type" "delayed_compare")])
  1961.  
  1962. (define_expand "extendqisi2"
  1963.   [(use (match_operand:SI 0 "gpc_reg_operand" ""))
  1964.    (use (match_operand:QI 1 "gpc_reg_operand" ""))]
  1965.   ""
  1966.   "
  1967. {
  1968.   if (TARGET_POWER)
  1969.     emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
  1970.   else
  1971.     emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
  1972.   DONE;
  1973. }")
  1974.  
  1975. (define_expand "extendqisi2_power"
  1976.   [(parallel [(set (match_dup 2)
  1977.            (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
  1978.                   (const_int 24)))
  1979.           (clobber (scratch:SI))])
  1980.    (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
  1981.            (ashiftrt:SI (match_dup 2)
  1982.                 (const_int 24)))
  1983.           (clobber (scratch:SI))])]
  1984.   "TARGET_POWER"
  1985.   "
  1986. { operands[1] = gen_lowpart (SImode, operands[1]);
  1987.   operands[2] = gen_reg_rtx (SImode); }")
  1988.  
  1989. (define_expand "extendqisi2_no_power"
  1990.   [(set (match_dup 2)
  1991.            (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
  1992.                   (const_int 24)))
  1993.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  1994.            (ashiftrt:SI (match_dup 2)
  1995.                 (const_int 24)))]
  1996.   "! TARGET_POWER"
  1997.   "
  1998. { operands[1] = gen_lowpart (SImode, operands[1]);
  1999.   operands[2] = gen_reg_rtx (SImode); }")
  2000.  
  2001. (define_expand "extendqihi2"
  2002.   [(use (match_operand:HI 0 "gpc_reg_operand" ""))
  2003.    (use (match_operand:QI 1 "gpc_reg_operand" ""))]
  2004.   ""
  2005.   "
  2006. {
  2007.   if (TARGET_POWER)
  2008.     emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
  2009.   else
  2010.     emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
  2011.   DONE;
  2012. }")
  2013.  
  2014. (define_expand "extendqihi2_power"
  2015.   [(parallel [(set (match_dup 2)
  2016.            (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
  2017.                   (const_int 24)))
  2018.           (clobber (scratch:SI))])
  2019.    (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
  2020.            (ashiftrt:SI (match_dup 2)
  2021.                 (const_int 24)))
  2022.           (clobber (scratch:SI))])]
  2023.   "TARGET_POWER"
  2024.   "
  2025. { operands[0] = gen_lowpart (SImode, operands[0]);
  2026.   operands[1] = gen_lowpart (SImode, operands[1]);
  2027.   operands[2] = gen_reg_rtx (SImode); }")
  2028.  
  2029. (define_expand "extendqihi2_no_power"
  2030.   [(set (match_dup 2)
  2031.            (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
  2032.                   (const_int 24)))
  2033.    (set (match_operand:HI 0 "gpc_reg_operand" "")
  2034.            (ashiftrt:SI (match_dup 2)
  2035.                 (const_int 24)))]
  2036.   "! TARGET_POWER"
  2037.   "
  2038. { operands[0] = gen_lowpart (SImode, operands[0]);
  2039.   operands[1] = gen_lowpart (SImode, operands[1]);
  2040.   operands[2] = gen_reg_rtx (SImode); }")
  2041.  
  2042. ;; Floating-point insns, excluding normal data motion.
  2043. ;;
  2044. ;; PowerPC has a full set of single-precision floating point instructions.
  2045. ;;
  2046. ;; For the POWER architecture, we pretend that we have both SFmode and
  2047. ;; DFmode insns, while, in fact, all fp insns are actually done in double.
  2048. ;; The only conversions we will do will be when storing to memory.  In that
  2049. ;; case, we will use the "frsp" instruction before storing.
  2050. ;;
  2051. ;; Note that when we store into a single-precision memory location, we need to
  2052. ;; use the frsp insn first.  If the register being stored isn't dead, we
  2053. ;; need a scratch register for the frsp.  But this is difficult when the store
  2054. ;; is done by reload.  It is not incorrect to do the frsp on the register in
  2055. ;; this case, we just lose precision that we would have otherwise gotten but
  2056. ;; is not guaranteed.  Perhaps this should be tightened up at some point.
  2057.  
  2058. (define_insn "extendsfdf2"
  2059.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2060.     (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
  2061.   ""
  2062.   "*
  2063. {
  2064.   if (REGNO (operands[0]) == REGNO (operands[1]))
  2065.     return \"\";
  2066.   else
  2067.     return \"fmr %0,%1\";
  2068. }"
  2069.   [(set_attr "type" "fp")])
  2070.  
  2071. (define_insn "truncdfsf2"
  2072.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2073.     (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
  2074.   ""
  2075.   "frsp %0,%1"
  2076.   [(set_attr "type" "fp")])
  2077.  
  2078. (define_insn "negsf2"
  2079.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2080.     (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
  2081.   ""
  2082.   "fneg %0,%1"
  2083.   [(set_attr "type" "fp")])
  2084.  
  2085. (define_insn "abssf2"
  2086.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2087.     (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
  2088.   ""
  2089.   "fabs %0,%1"
  2090.   [(set_attr "type" "fp")])
  2091.  
  2092. (define_insn ""
  2093.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2094.     (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
  2095.   ""
  2096.   "fnabs %0,%1"
  2097.   [(set_attr "type" "fp")])
  2098.  
  2099. (define_expand "addsf3"
  2100.   [(set (match_operand:SF 0 "gpc_reg_operand" "")
  2101.     (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
  2102.          (match_operand:SF 2 "gpc_reg_operand" "")))]
  2103.   ""
  2104.   "")
  2105.  
  2106. (define_insn ""
  2107.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2108.     (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2109.          (match_operand:SF 2 "gpc_reg_operand" "f")))]
  2110.   "TARGET_POWERPC"
  2111.   "fadds %0,%1,%2"
  2112.   [(set_attr "type" "fp")])
  2113.  
  2114. (define_insn ""
  2115.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2116.     (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2117.          (match_operand:SF 2 "gpc_reg_operand" "f")))]
  2118.   "TARGET_POWER"
  2119.   "{fa|fadd} %0,%1,%2"
  2120.   [(set_attr "type" "fp")])
  2121.  
  2122. (define_expand "subsf3"
  2123.   [(set (match_operand:SF 0 "gpc_reg_operand" "")
  2124.     (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
  2125.           (match_operand:SF 2 "gpc_reg_operand" "")))]
  2126.   ""
  2127.   "")
  2128.  
  2129. (define_insn ""
  2130.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2131.     (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
  2132.           (match_operand:SF 2 "gpc_reg_operand" "f")))]
  2133.   "TARGET_POWERPC"
  2134.   "fsubs %0,%1,%2"
  2135.   [(set_attr "type" "fp")])
  2136.  
  2137. (define_insn ""
  2138.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2139.     (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
  2140.           (match_operand:SF 2 "gpc_reg_operand" "f")))]
  2141.   "TARGET_POWER"
  2142.   "{fs|fsub} %0,%1,%2"
  2143.   [(set_attr "type" "fp")])
  2144.  
  2145. (define_expand "mulsf3"
  2146.   [(set (match_operand:SF 0 "gpc_reg_operand" "")
  2147.     (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
  2148.          (match_operand:SF 2 "gpc_reg_operand" "")))]
  2149.   ""
  2150.   "")
  2151.  
  2152. (define_insn ""
  2153.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2154.     (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2155.          (match_operand:SF 2 "gpc_reg_operand" "f")))]
  2156.   "TARGET_POWERPC"
  2157.   "fmuls %0,%1,%2"
  2158.   [(set_attr "type" "fp")])
  2159.  
  2160. (define_insn ""
  2161.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2162.     (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2163.          (match_operand:SF 2 "gpc_reg_operand" "f")))]
  2164.   "TARGET_POWER"
  2165.   "{fm|fmul} %0,%1,%2"
  2166.   [(set_attr "type" "fp")])
  2167.  
  2168. (define_expand "divsf3"
  2169.   [(set (match_operand:SF 0 "gpc_reg_operand" "")
  2170.     (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
  2171.         (match_operand:SF 2 "gpc_reg_operand" "")))]
  2172.   ""
  2173.   "")
  2174.  
  2175. (define_insn ""
  2176.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2177.     (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
  2178.         (match_operand:SF 2 "gpc_reg_operand" "f")))]
  2179.   "TARGET_POWERPC"
  2180.   "fdivs %0,%1,%2"
  2181.   [(set_attr "type" "sdiv")])
  2182.  
  2183. (define_insn ""
  2184.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2185.     (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
  2186.         (match_operand:SF 2 "gpc_reg_operand" "f")))]
  2187.   "TARGET_POWER"
  2188.   "{fd|fdiv} %0,%1,%2"
  2189.   [(set_attr "type" "sdiv")])
  2190.  
  2191. (define_insn ""
  2192.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2193.     (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2194.               (match_operand:SF 2 "gpc_reg_operand" "f"))
  2195.          (match_operand:SF 3 "gpc_reg_operand" "f")))]
  2196.   "TARGET_POWERPC"
  2197.   "fmadds %0,%1,%2,%3"
  2198.   [(set_attr "type" "fp")])
  2199.  
  2200. (define_insn ""
  2201.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2202.     (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2203.               (match_operand:SF 2 "gpc_reg_operand" "f"))
  2204.          (match_operand:SF 3 "gpc_reg_operand" "f")))]
  2205.   "TARGET_POWER"
  2206.   "{fma|fmadd} %0,%1,%2,%3"
  2207.   [(set_attr "type" "fp")])
  2208.  
  2209. (define_insn ""
  2210.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2211.     (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2212.                (match_operand:SF 2 "gpc_reg_operand" "f"))
  2213.           (match_operand:SF 3 "gpc_reg_operand" "f")))]
  2214.   "TARGET_POWERPC"
  2215.   "fmsubs %0,%1,%2,%3"
  2216.   [(set_attr "type" "fp")])
  2217.  
  2218. (define_insn ""
  2219.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2220.     (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2221.                (match_operand:SF 2 "gpc_reg_operand" "f"))
  2222.           (match_operand:SF 3 "gpc_reg_operand" "f")))]
  2223.   "TARGET_POWER"
  2224.   "{fms|fmsub} %0,%1,%2,%3"
  2225.   [(set_attr "type" "fp")])
  2226.  
  2227. (define_insn ""
  2228.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2229.     (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2230.                   (match_operand:SF 2 "gpc_reg_operand" "f"))
  2231.              (match_operand:SF 3 "gpc_reg_operand" "f"))))]
  2232.   "TARGET_POWERPC"
  2233.   "fnmadds %0,%1,%2,%3"
  2234.   [(set_attr "type" "fp")])
  2235.  
  2236. (define_insn ""
  2237.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2238.     (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2239.                   (match_operand:SF 2 "gpc_reg_operand" "f"))
  2240.              (match_operand:SF 3 "gpc_reg_operand" "f"))))]
  2241.   "TARGET_POWER"
  2242.   "{fnma|fnmadd} %0,%1,%2,%3"
  2243.   [(set_attr "type" "fp")])
  2244.  
  2245. (define_insn ""
  2246.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2247.     (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2248.                    (match_operand:SF 2 "gpc_reg_operand" "f"))
  2249.               (match_operand:SF 3 "gpc_reg_operand" "f"))))]
  2250.   "TARGET_POWERPC"
  2251.   "fnmsubs %0,%1,%2,%3"
  2252.   [(set_attr "type" "fp")])
  2253.  
  2254. (define_insn ""
  2255.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2256.     (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  2257.                    (match_operand:SF 2 "gpc_reg_operand" "f"))
  2258.               (match_operand:SF 3 "gpc_reg_operand" "f"))))]
  2259.   "TARGET_POWER"
  2260.   "{fnms|fnmsub} %0,%1,%2,%3"
  2261.   [(set_attr "type" "fp")])
  2262.  
  2263. (define_expand "sqrtsf2"
  2264.   [(set (match_operand:SF 0 "gpc_reg_operand" "")
  2265.     (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
  2266.   "TARGET_POWERPCSQR || TARGET_POWER2"
  2267.   "")
  2268.  
  2269. (define_insn ""
  2270.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2271.     (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
  2272.   "TARGET_POWERPCSQR"
  2273.   "fsqrts %0,%1"
  2274.   [(set_attr "type" "ssqrt")])
  2275.  
  2276. (define_insn ""
  2277.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  2278.     (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
  2279.   "TARGET_POWER2"
  2280.   "fsqrt %0,%1"
  2281.   [(set_attr "type" "dsqrt")])
  2282.  
  2283. (define_insn "negdf2"
  2284.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2285.     (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
  2286.   ""
  2287.   "fneg %0,%1"
  2288.   [(set_attr "type" "fp")])
  2289.  
  2290. (define_insn "absdf2"
  2291.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2292.     (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
  2293.   ""
  2294.   "fabs %0,%1"
  2295.   [(set_attr "type" "fp")])
  2296.  
  2297. (define_insn ""
  2298.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2299.     (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
  2300.   ""
  2301.   "fnabs %0,%1"
  2302.   [(set_attr "type" "fp")])
  2303.  
  2304. (define_insn "adddf3"
  2305.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2306.     (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  2307.          (match_operand:DF 2 "gpc_reg_operand" "f")))]
  2308.   ""
  2309.   "{fa|fadd} %0,%1,%2"
  2310.   [(set_attr "type" "fp")])
  2311.  
  2312. (define_insn "subdf3"
  2313.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2314.     (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
  2315.           (match_operand:DF 2 "gpc_reg_operand" "f")))]
  2316.   ""
  2317.   "{fs|fsub} %0,%1,%2"
  2318.   [(set_attr "type" "fp")])
  2319.  
  2320. (define_insn "muldf3"
  2321.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2322.     (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  2323.          (match_operand:DF 2 "gpc_reg_operand" "f")))]
  2324.   ""
  2325.   "{fm|fmul} %0,%1,%2"
  2326.   [(set_attr "type" "dmul")])
  2327.  
  2328. (define_insn "divdf3"
  2329.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2330.     (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
  2331.         (match_operand:DF 2 "gpc_reg_operand" "f")))]
  2332.   ""
  2333.   "{fd|fdiv} %0,%1,%2"
  2334.   [(set_attr "type" "ddiv")])
  2335.  
  2336. (define_insn ""
  2337.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2338.     (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  2339.               (match_operand:DF 2 "gpc_reg_operand" "f"))
  2340.          (match_operand:DF 3 "gpc_reg_operand" "f")))]
  2341.   ""
  2342.   "{fma|fmadd} %0,%1,%2,%3"
  2343.   [(set_attr "type" "dmul")])
  2344.  
  2345. (define_insn ""
  2346.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2347.     (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  2348.                (match_operand:DF 2 "gpc_reg_operand" "f"))
  2349.           (match_operand:DF 3 "gpc_reg_operand" "f")))]
  2350.   ""
  2351.   "{fms|fmsub} %0,%1,%2,%3"
  2352.   [(set_attr "type" "dmul")])
  2353.  
  2354. (define_insn ""
  2355.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2356.     (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  2357.                   (match_operand:DF 2 "gpc_reg_operand" "f"))
  2358.              (match_operand:DF 3 "gpc_reg_operand" "f"))))]
  2359.   ""
  2360.   "{fnma|fnmadd} %0,%1,%2,%3"
  2361.   [(set_attr "type" "dmul")])
  2362.  
  2363. (define_insn ""
  2364.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2365.     (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  2366.                    (match_operand:DF 2 "gpc_reg_operand" "f"))
  2367.               (match_operand:DF 3 "gpc_reg_operand" "f"))))]
  2368.   ""
  2369.   "{fnms|fnmsub} %0,%1,%2,%3"
  2370.   [(set_attr "type" "dmul")])
  2371.  
  2372. (define_insn "sqrtdf2"
  2373.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  2374.     (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
  2375.   "TARGET_POWERPCSQR || TARGET_POWER2"
  2376.   "fsqrt %0,%1"
  2377.   [(set_attr "type" "dsqrt")])
  2378.  
  2379. ;; Conversions to and from floating-point.
  2380. (define_expand "floatsidf2"
  2381.   [(set (match_dup 2)
  2382.     (plus:DI (zero_extend:DI
  2383.           (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
  2384.               (match_dup 3)))
  2385.          (match_dup 4)))
  2386.    (set (match_operand:DF 0 "gpc_reg_operand" "")
  2387.     (minus:DF (subreg:DF (match_dup 2) 0)
  2388.           (match_dup 5)))]
  2389.   ""
  2390.   "
  2391. {
  2392. #if HOST_BITS_PER_INT != BITS_PER_WORD
  2393.   /* Maybe someone can figure out how to do this in that case.  I don't
  2394.      want to right now.  */
  2395.   abort ();
  2396. #endif
  2397.  
  2398.   operands[2] = gen_reg_rtx (DImode);
  2399.   operands[3] = gen_rtx (CONST_INT, VOIDmode, 0x80000000);
  2400.   operands[4] = immed_double_const (0, 0x43300000, DImode);
  2401.   operands[5] = force_reg (DFmode, immed_double_const (0x43300000,
  2402.                                0x80000000, DFmode));
  2403. }")
  2404.  
  2405. (define_expand "floatunssidf2"
  2406.   [(set (match_dup 2)
  2407.     (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
  2408.          (match_dup 3)))
  2409.    (set (match_operand:DF 0 "gpc_reg_operand" "")
  2410.     (minus:DF (subreg:DF (match_dup 2) 0)
  2411.           (match_dup 4)))]
  2412.   ""
  2413.   "
  2414. {
  2415. #if HOST_BITS_PER_INT != BITS_PER_WORD
  2416.   /* Maybe someone can figure out how to do this in that case.  I don't
  2417.      want to right now.  */
  2418.   abort ();
  2419. #endif
  2420.  
  2421.   operands[2] = gen_reg_rtx (DImode);
  2422.   operands[3] = immed_double_const (0, 0x43300000, DImode);
  2423.   operands[4] = force_reg (DFmode, immed_double_const (0x43300000, 0, DFmode));
  2424. }")
  2425.  
  2426. ;; For the above two cases, we always split.
  2427. (define_split
  2428.   [(set (match_operand:DI 0 "gpc_reg_operand" "")
  2429.     (plus:DI (zero_extend:DI
  2430.           (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
  2431.               (match_operand:SI 2 "logical_operand" "")))
  2432.          (match_operand:DI 3 "immediate_operand" "")))]
  2433.   "reload_completed && HOST_BITS_PER_INT == BITS_PER_WORD
  2434.    && GET_CODE (operands[3]) == CONST_DOUBLE
  2435.    && CONST_DOUBLE_LOW (operands[3]) == 0"
  2436.   [(set (match_dup 6) (xor:SI (match_dup 1) (match_dup 2)))
  2437.    (set (match_dup 4) (match_dup 5))]
  2438.   "
  2439. { operands[4] = operand_subword (operands[0], 0, 0, DImode);
  2440.   operands[5] = operand_subword (operands[3], 0, 0, DImode);
  2441.   operands[6] = operand_subword (operands[0], 1, 0, DImode);
  2442. }")
  2443.  
  2444. (define_insn ""
  2445.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  2446.     (plus:DI (zero_extend:DI
  2447.           (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
  2448.               (match_operand:SI 2 "logical_operand" "rKJ")))
  2449.          (match_operand:DI 3 "immediate_operand" "n")))]
  2450.   "HOST_BITS_PER_INT == BITS_PER_WORD
  2451.    && GET_CODE (operands[3]) == CONST_DOUBLE
  2452.    && CONST_DOUBLE_LOW (operands[3]) == 0"
  2453.   "#"
  2454.   [(set_attr "length" "8")])
  2455.   
  2456. (define_split
  2457.   [(set (match_operand:DI 0 "gpc_reg_operand" "=")
  2458.     (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
  2459.          (match_operand:DI 2 "immediate_operand" "")))]
  2460.   "reload_completed && HOST_BITS_PER_INT == BITS_PER_WORD
  2461.    && GET_CODE (operands[2]) == CONST_DOUBLE
  2462.    && CONST_DOUBLE_LOW (operands[2]) == 0"
  2463.   [(set (match_dup 3) (match_dup 4))
  2464.    (set (match_dup 5) (match_dup 1))]
  2465.   "
  2466. { operands[3] = operand_subword (operands[0], 0, 0, DImode);
  2467.   operands[4] = operand_subword (operands[2], 0, 0, DImode);
  2468.   operands[5] = operand_subword (operands[0], 1, 0, DImode);
  2469.  
  2470.   if (rtx_equal_p (operands[1], operands[5]))
  2471.     {
  2472.       emit_move_insn (operands[3], operands[4]);
  2473.       DONE;
  2474.     }
  2475.  
  2476.   if (rtx_equal_p (operands[1], operands[3]))
  2477.     {
  2478.       rtx temp;
  2479.  
  2480.       temp = operands[3]; operands[3] = operands[5]; operands[5] = temp;
  2481.       temp = operands[4]; operands[4] = operands[1]; operands[1] = temp;
  2482.     }
  2483. }")
  2484.  
  2485. (define_insn ""
  2486.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  2487.     (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
  2488.          (match_operand:DI 2 "immediate_operand" "n")))]
  2489.   "HOST_BITS_PER_INT == BITS_PER_WORD
  2490.    && GET_CODE (operands[2]) == CONST_DOUBLE
  2491.    && CONST_DOUBLE_LOW (operands[2]) == 0"
  2492.   "#"
  2493.   [(set_attr "length" "8")])
  2494.  
  2495. (define_expand "fix_truncdfsi2"
  2496.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  2497.     (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
  2498.   ""
  2499.   "
  2500. {
  2501.   emit_insn (gen_trunc_call (operands[0], operands[1],
  2502.                  gen_rtx (SYMBOL_REF, Pmode, \"itrunc\")));
  2503.   DONE;
  2504. }")
  2505.  
  2506. (define_expand "fixuns_truncdfsi2"
  2507.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  2508.     (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
  2509.   ""
  2510.   "
  2511. {
  2512.   emit_insn (gen_trunc_call (operands[0], operands[1],
  2513.                  gen_rtx (SYMBOL_REF, Pmode, \"uitrunc\")));
  2514.   DONE;
  2515. }")
  2516.  
  2517.  
  2518. (define_expand "trunc_call"
  2519.   [(parallel [(set (match_operand:SI 0 "" "")
  2520.            (fix:SI (match_operand:DF 1 "" "")))
  2521.           (use (match_operand:SI 2 "" ""))])]
  2522.   ""
  2523.   "
  2524. {
  2525.   rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
  2526.   rtx first = XVECEXP (insns, 0, 0);
  2527.   rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
  2528.  
  2529.   REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
  2530.                    REG_NOTES (first));
  2531.   REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
  2532.  
  2533.   emit_insn (insns);
  2534.   DONE;
  2535. }")
  2536.  
  2537. (define_expand "trunc_call_rtl"
  2538.   [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
  2539.    (use (reg:DF 33))
  2540.    (parallel [(set (reg:SI 3)
  2541.            (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
  2542.           (clobber (scratch:SI))])
  2543.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  2544.     (reg:SI 3))]
  2545.   ""
  2546.   "
  2547.   rs6000_trunc_used = 1;
  2548. }")
  2549.  
  2550. ;; Define the DImode operations that can be done in a small number
  2551. ;; of instructions.
  2552. (define_expand "adddi3"
  2553.   [(set (match_operand:DI 0 "gpc_reg_operand" "")
  2554.     (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
  2555.          (match_operand:DI 2 "reg_or_short_operand" "")))]
  2556.   ""
  2557.   "
  2558. {
  2559.   if (! TARGET_POWER
  2560.       && short_cint_operand (operands[2], DImode))
  2561.     FAIL;
  2562. }")
  2563.  
  2564. (define_insn ""
  2565.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
  2566.     (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
  2567.          (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
  2568.   "TARGET_POWER"
  2569.   "@
  2570.    {a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2
  2571.    {ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1"
  2572.   [(set_attr "length" "8")])
  2573.  
  2574. (define_insn ""
  2575.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  2576.     (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
  2577.          (match_operand:DI 2 "gpc_reg_operand" "r")))]
  2578.   "! TARGET_POWER"
  2579.   "addc %L0,%L1,%L2\;adde %0,%1,%2"
  2580.   [(set_attr "length" "8")])
  2581.  
  2582. (define_expand "subdi3"
  2583.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
  2584.     (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
  2585.           (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
  2586.   ""
  2587.   "
  2588. {
  2589.   if (! TARGET_POWER
  2590.       && short_cint_operand (operands[1], DImode))
  2591.     FAIL;
  2592. }")
  2593.  
  2594. (define_insn ""
  2595.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
  2596.     (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
  2597.           (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
  2598.   "TARGET_POWER"
  2599.   "@
  2600.    {sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1
  2601.    {sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2"
  2602.   [(set_attr "length" "8")])
  2603.  
  2604. (define_insn ""
  2605.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  2606.     (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
  2607.           (match_operand:DI 2 "gpc_reg_operand" "r")))]
  2608.   "! TARGET_POWER"
  2609.   "subfc %L0,%L2,%L1\;subfe %0,%2,%1"
  2610.   [(set_attr "length" "8")])
  2611.  
  2612. (define_expand "negdi2"
  2613.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  2614.     (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
  2615.   ""
  2616.   "")
  2617.  
  2618. (define_insn ""
  2619.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  2620.     (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
  2621.   ""
  2622.   "{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1"
  2623.   [(set_attr "length" "8")])
  2624.  
  2625. (define_insn "mulsidi3"
  2626.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  2627.     (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
  2628.          (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
  2629.    (clobber (match_scratch:SI 3 "=q"))]
  2630.   "TARGET_POWER"
  2631.   "mul %0,%1,%2\;mfmq %L0"
  2632.   [(set_attr "length" "8")])
  2633.  
  2634. ;; If operands 0 and 2 are in the same register, we have a problem.  But
  2635. ;; operands 0 and 1 (the usual case) can be in the same register.  That's
  2636. ;; why we have the strange constraints below.
  2637. (define_insn "ashldi3"
  2638.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
  2639.     (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
  2640.            (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
  2641.    (clobber (match_scratch:SI 3 "=X,q,q,q"))]
  2642.   "TARGET_POWER"
  2643.   "@
  2644.    {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
  2645.    sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
  2646.    sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
  2647.    sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
  2648.   [(set_attr "length" "8")])
  2649.  
  2650. (define_insn "lshrdi3"
  2651.   [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r,r,&r")
  2652.     (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
  2653.              (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
  2654.    (clobber (match_scratch:SI 3 "=X,q,q,q"))]
  2655.   "TARGET_POWER"
  2656.   "@
  2657.    {cal %0,0(0)|li %0,0}\;{s%A2i|s%A2wi} %L0,%1,%h2
  2658.    sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
  2659.    sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
  2660.    sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
  2661.   [(set_attr "length" "8")])
  2662.  
  2663. ;; Shift by a variable amount is too complex to be worth open-coding.  We
  2664. ;; just handle shifts by constants.
  2665.  
  2666. (define_expand "ashrdi3"
  2667.   [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=")
  2668.            (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
  2669.                 (match_operand:SI 2 "general_operand" "")))
  2670.           (clobber (match_scratch:SI 3 ""))])]
  2671.   "TARGET_POWER"
  2672.   "
  2673. { if (GET_CODE (operands[2]) != CONST_INT)
  2674.     FAIL;
  2675. }")
  2676.  
  2677. (define_insn ""
  2678.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
  2679.     (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
  2680.              (match_operand:SI 2 "const_int_operand" "M,i")))
  2681.    (clobber (match_scratch:SI 3 "=X,q"))]
  2682.   "TARGET_POWER"
  2683.   "@
  2684.    {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
  2685.    sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
  2686.   [(set_attr "length" "8")])
  2687.  
  2688. ;; Now define ways of moving data around.
  2689. ;;
  2690. ;; For SI, we special-case integers that can't be loaded in one insn.  We
  2691. ;; do the load 16-bits at a time.  We could do this by loading from memory,
  2692. ;; and this is even supposed to be faster, but it is simpler not to get
  2693. ;; integers in the TOC.
  2694. (define_expand "movsi"
  2695.   [(set (match_operand:SI 0 "general_operand" "")
  2696.     (match_operand:SI 1 "any_operand" ""))]
  2697.   ""
  2698.   "
  2699. {
  2700.   if (GET_CODE (operands[0]) != REG)
  2701.     operands[1] = force_reg (SImode, operands[1]);
  2702.  
  2703.   if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT
  2704.       && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
  2705.     {
  2706.       operands[1] = force_const_mem (SImode, operands[1]);
  2707.       if (! memory_address_p (SImode, XEXP (operands[1], 0))
  2708.       && ! reload_in_progress)
  2709.     operands[1] = change_address (operands[1], SImode,
  2710.                       XEXP (operands[1], 0));
  2711.     }
  2712.  
  2713.   if (GET_CODE (operands[1]) == CONST_INT
  2714.       && (unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
  2715.       && (INTVAL (operands[1]) & 0xffff) != 0)
  2716.     {
  2717.       emit_move_insn (operands[0],
  2718.               gen_rtx (CONST_INT, VOIDmode,
  2719.                    INTVAL (operands[1]) & 0xffff0000));
  2720.       emit_insn (gen_iorsi3 (operands[0], operands[0],
  2721.                  gen_rtx (CONST_INT, VOIDmode,
  2722.                       INTVAL (operands[1]) & 0xffff)));
  2723.       DONE;
  2724.     }
  2725. }")
  2726.  
  2727. (define_insn ""
  2728.   [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,m,r,r,r,*c*q,*l,*h")
  2729.     (match_operand:SI 1 "input_operand" "r,m,r,I,J,*h,r,r,0"))]
  2730.   "TARGET_POWER && (gpc_reg_operand (operands[0], SImode)
  2731.    || gpc_reg_operand (operands[1], SImode))"
  2732.   "@
  2733.    {ai|addic} %0,%1,0
  2734.    {l%U1%X1|lwz%U1%X1} %0,%1
  2735.    {st%U0%X0|stw%U0%X0} %1,%0
  2736.    {cal %0,%1(0)|li %0,%1}
  2737.    {cau %0,0,%u1|lis %0,%u1}
  2738.    mf%1 %0
  2739.    mt%0 %1
  2740.    mt%0 %1
  2741.    cror 0,0,0"
  2742.   [(set_attr "type" "*,load,*,*,*,*,*,mtlr,*")])
  2743.  
  2744. (define_insn ""
  2745.   [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,m,r,r,r,*h")
  2746.     (match_operand:SI 1 "input_operand" "r,m,r,I,J,*h,r"))]
  2747.   "! TARGET_POWER && (gpc_reg_operand (operands[0], SImode)
  2748.    || gpc_reg_operand (operands[1], SImode))"
  2749.   "@
  2750.    mr %0,%1
  2751.    lwz%U1%X1 %0,%1
  2752.    stw%U0%X0 %1,%0
  2753.    li %0,%1
  2754.    lis %0,%u1
  2755.    mf%1 %0
  2756.    mt%0 %1"
  2757.   [(set_attr "type" "*,load,*,*,*,*,*")])
  2758.  
  2759. ;; Split a load of a large constant into the appropriate two-insn
  2760. ;; sequence.
  2761.  
  2762. (define_split
  2763.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  2764.     (match_operand:SI 1 "const_int_operand" ""))]
  2765.   "(unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
  2766.    && (INTVAL (operands[1]) & 0xffff) != 0"
  2767.   [(set (match_dup 0)
  2768.     (match_dup 2))
  2769.    (set (match_dup 0)
  2770.     (ior:SI (match_dup 0)
  2771.         (match_dup 3)))]
  2772.   "
  2773. {
  2774.   operands[2] = gen_rtx (CONST_INT, VOIDmode,
  2775.              INTVAL (operands[1]) & 0xffff0000);
  2776.   operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff);
  2777. }")
  2778.  
  2779. (define_insn ""
  2780.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  2781.     (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
  2782.             (const_int 0)))
  2783.    (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
  2784.   ""
  2785.   "{ai.|addic.} %0,%1,0"
  2786.   [(set_attr "type" "compare")])
  2787.  
  2788. (define_expand "movhi"
  2789.   [(set (match_operand:HI 0 "general_operand" "")
  2790.     (match_operand:HI 1 "any_operand" ""))]
  2791.   ""
  2792.   "
  2793. {
  2794.   if (GET_CODE (operands[0]) != REG)
  2795.     operands[1] = force_reg (HImode, operands[1]);
  2796.  
  2797.   if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
  2798.     {
  2799.       operands[1] = force_const_mem (HImode, operands[1]);
  2800.       if (! memory_address_p (HImode, XEXP (operands[1], 0))
  2801.       && ! reload_in_progress)
  2802.     operands[1] = change_address (operands[1], HImode,
  2803.                       XEXP (operands[1], 0));
  2804.     }
  2805. }")
  2806.  
  2807. (define_insn ""
  2808.   [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*h,*h")
  2809.     (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
  2810.   "TARGET_POWER && (gpc_reg_operand (operands[0], HImode)
  2811.    || gpc_reg_operand (operands[1], HImode))"
  2812.   "@
  2813.    {oril|ori} %0,%1,0
  2814.    lhz%U1%X1 %0,%1
  2815.    sth%U0%X0 %1,%0
  2816.    {cal %0,%w1(0)|li %0,%w1}
  2817.    mf%1 %0
  2818.    mt%0 %1
  2819.    cror 0,0,0"
  2820.   [(set_attr "type" "*,load,*,*,*,*,*")])
  2821.  
  2822. (define_insn ""
  2823.   [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*h")
  2824.     (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r"))]
  2825.   "! TARGET_POWER && (gpc_reg_operand (operands[0], HImode)
  2826.    || gpc_reg_operand (operands[1], HImode))"
  2827.   "@
  2828.    ori %0,%1,0
  2829.    lhz%U1%X1 %0,%1
  2830.    sth%U0%X0 %1,%0
  2831.    li %0,%w1
  2832.    mf%1 %0
  2833.    mt%0 %1"
  2834.   [(set_attr "type" "*,load,*,*,*,*")])
  2835.  
  2836. (define_expand "movqi"
  2837.   [(set (match_operand:QI 0 "general_operand" "")
  2838.     (match_operand:QI 1 "any_operand" ""))]
  2839.   ""
  2840.   "
  2841. {
  2842.   if (GET_CODE (operands[0]) != REG)
  2843.     operands[1] = force_reg (QImode, operands[1]);
  2844.  
  2845.   if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
  2846.     {
  2847.       operands[1] = force_const_mem (QImode, operands[1]);
  2848.       if (! memory_address_p (QImode, XEXP (operands[1], 0))
  2849.       && ! reload_in_progress)
  2850.     operands[1] = change_address (operands[1], QImode,
  2851.                       XEXP (operands[1], 0));
  2852.     }
  2853. }")
  2854.  
  2855. (define_insn ""
  2856.   [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*h,*h")
  2857.     (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
  2858.   "TARGET_POWER && (gpc_reg_operand (operands[0], QImode)
  2859.    || gpc_reg_operand (operands[1], QImode))"
  2860.   "@
  2861.    {oril|ori} %0,%1,0
  2862.    lbz%U1%X1 %0,%1
  2863.    stb%U0%X0 %1,%0
  2864.    {cal %0,%1(0)|li %0,%1}
  2865.    mf%1 %0
  2866.    mt%0 %1
  2867.    cror 0,0,0"
  2868.   [(set_attr "type" "*,load,*,*,*,*,*")])
  2869.  
  2870. (define_insn ""
  2871.   [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*h")
  2872.     (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r"))]
  2873.   "! TARGET_POWER && (gpc_reg_operand (operands[0], QImode)
  2874.    || gpc_reg_operand (operands[1], QImode))"
  2875.   "@
  2876.    mr %0,%1
  2877.    lbz%U1%X1 %0,%1
  2878.    stb%U0%X0 %1,%0
  2879.    li %0,%1
  2880.    mf%1 %0
  2881.    mt%0 %1"
  2882.   [(set_attr "type" "*,load,*,*,*,*")])
  2883.  
  2884. ;; Here is how to move condition codes around.  When we store CC data in
  2885. ;; an integer register or memory, we store just the high-order 4 bits.
  2886. ;; This lets us not shift in the most common case of CR0.
  2887. (define_expand "movcc"
  2888.   [(set (match_operand:CC 0 "nonimmediate_operand" "")
  2889.     (match_operand:CC 1 "nonimmediate_operand" ""))]
  2890.   ""
  2891.   "")
  2892.  
  2893. (define_insn ""
  2894.   [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
  2895.     (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
  2896.   "register_operand (operands[0], CCmode)
  2897.    || register_operand (operands[1], CCmode)"
  2898.   "@
  2899.    mcrf %0,%1
  2900.    mtcrf 128,%1
  2901.    {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
  2902.    mfcr %0
  2903.    mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
  2904.    {ai %0,%1,0|mr %0,%1}
  2905.    {l%U1%X1|lwz%U1%X1} %0,%1
  2906.    {st%U0%U1|stw%U0%U1} %1,%0"
  2907.   [(set_attr "type" "*,*,*,compare,*,*,load,*")
  2908.    (set_attr "length" "*,*,12,*,8,*,*,*")])
  2909.  
  2910. ;; For floating-point, we normally deal with the floating-point registers.
  2911. ;; The sole exception is that parameter passing can produce floating-point
  2912. ;; values in fixed-point registers.  Unless the value is a simple constant
  2913. ;; or already in memory, we deal with this by allocating memory and copying
  2914. ;; the value explicitly via that memory location.
  2915. (define_expand "movsf"
  2916.   [(set (match_operand:SF 0 "nonimmediate_operand" "")
  2917.     (match_operand:SF 1 "any_operand" ""))]
  2918.   ""
  2919.   "
  2920. {
  2921.   /* If we are called from reload, we might be getting a SUBREG of a hard
  2922.      reg.  So expand it.  */
  2923.   if (GET_CODE (operands[0]) == SUBREG
  2924.       && GET_CODE (SUBREG_REG (operands[0])) == REG
  2925.       && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
  2926.     operands[0] = alter_subreg (operands[0]);
  2927.   if (GET_CODE (operands[1]) == SUBREG
  2928.       && GET_CODE (SUBREG_REG (operands[1])) == REG
  2929.       && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
  2930.     operands[1] = alter_subreg (operands[1]);
  2931.  
  2932.   if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
  2933.     {
  2934.       rtx stack_slot;
  2935.  
  2936.       /* If this is a store to memory or another integer register do the
  2937.      move directly.  Otherwise store to a temporary stack slot and
  2938.      load from there into a floating point register.  */
  2939.  
  2940.       if (GET_CODE (operands[0]) == MEM
  2941.       || (GET_CODE (operands[0]) == REG
  2942.           && (REGNO (operands[0]) < 32
  2943.           || (reload_in_progress
  2944.               && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))))
  2945.     {
  2946.       emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
  2947.               operand_subword (operands[1], 0, 0, SFmode));
  2948.       DONE;
  2949.     }
  2950.  
  2951.       stack_slot = gen_rtx (MEM, SFmode, plus_constant (stack_pointer_rtx, 4));
  2952.       emit_move_insn (stack_slot, operands[1]);
  2953.       emit_move_insn (operands[0], stack_slot);
  2954.       DONE;
  2955.     }
  2956.  
  2957.   if (GET_CODE (operands[0]) == MEM)
  2958.     operands[1] = force_reg (SFmode, operands[1]);
  2959.  
  2960.   if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
  2961.     {
  2962.       rtx stack_slot;
  2963.  
  2964.       if (GET_CODE (operands[1]) == MEM
  2965. #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
  2966.       || GET_CODE (operands[1]) == CONST_DOUBLE
  2967. #endif
  2968.       || (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
  2969.       || (reload_in_progress && GET_CODE (operands[1]) == REG
  2970.           && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))
  2971.     {
  2972.       emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
  2973.               operand_subword (operands[1], 0, 0, SFmode));
  2974.       DONE;
  2975.     }
  2976.  
  2977.       if (reload_in_progress)
  2978.     stack_slot = gen_rtx (MEM, SFmode,
  2979.                   plus_constant (stack_pointer_rtx, 4));
  2980.       else
  2981.     stack_slot = assign_stack_temp (SFmode, 4, 0);
  2982.       emit_move_insn (stack_slot, operands[1]);
  2983.       emit_move_insn (operands[0], stack_slot);
  2984.       DONE;
  2985.     }
  2986.  
  2987.   if (CONSTANT_P (operands[1]))
  2988.     {
  2989.       operands[1] = force_const_mem (SFmode, operands[1]);
  2990.       if (! memory_address_p (SFmode, XEXP (operands[1], 0))
  2991.       && ! reload_in_progress)
  2992.     operands[1] = change_address (operands[1], SFmode,
  2993.                       XEXP (operands[1], 0));
  2994.     }
  2995. }")
  2996.  
  2997. (define_split
  2998.   [(set (match_operand:SF 0 "gpc_reg_operand" "")
  2999.     (match_operand:SF 1 "easy_fp_constant" ""))]
  3000.   "reload_completed && REGNO (operands[0]) <= 31"
  3001.   [(set (match_dup 2) (match_dup 3))]
  3002.   "
  3003. { operands[2] = operand_subword (operands[0], 0, 0, SFmode);
  3004.   operands[3] = operand_subword (operands[1], 0, 0, SFmode); }")
  3005.   
  3006. (define_insn ""
  3007.   [(set (match_operand:SF 0 "fp_reg_or_mem_operand" "=f,f,m")
  3008.     (match_operand:SF 1 "input_operand" "f,m,f"))]
  3009.   "gpc_reg_operand (operands[0], SFmode)
  3010.    || gpc_reg_operand (operands[1], SFmode)"
  3011.   "@
  3012.    fmr %0,%1
  3013.    lfs%U1%X1 %0,%1
  3014.    frsp %1,%1\;stfs%U0%X0 %1,%0"
  3015.   [(set_attr "type" "fp,fpload,*")
  3016.    (set_attr "length" "*,*,8")])
  3017.  
  3018. (define_expand "movdf"
  3019.   [(set (match_operand:DF 0 "nonimmediate_operand" "")
  3020.     (match_operand:DF 1 "any_operand" ""))]
  3021.   ""
  3022.   "
  3023. {
  3024.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  3025.     {
  3026.       emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
  3027.               operand_subword_force (operands[1], 1, DFmode));
  3028.       emit_move_insn (operand_subword (operands[0], 0, 1, DFmode),
  3029.               operand_subword_force (operands[1], 0, DFmode));
  3030.       DONE;
  3031.     }
  3032.  
  3033.   if (GET_CODE (operands[0]) != REG)
  3034.     operands[1] = force_reg (DFmode, operands[1]);
  3035.  
  3036.   if (CONSTANT_P (operands[1]) && ! easy_fp_constant (operands[1], DFmode))
  3037.     {
  3038.       operands[1] = force_const_mem (DFmode, operands[1]);
  3039.       if (! memory_address_p (DFmode, XEXP (operands[1], 0))
  3040.       && ! reload_in_progress)
  3041.     operands[1] = change_address (operands[1], DFmode,
  3042.                       XEXP (operands[1], 0));
  3043.     }
  3044. }")
  3045.  
  3046. (define_split
  3047.   [(set (match_operand:DF 0 "gpc_reg_operand" "")
  3048.     (match_operand:DF 1 "easy_fp_constant" ""))]
  3049.   "reload_completed && REGNO (operands[0]) <= 31"
  3050.   [(set (match_dup 2) (match_dup 3))
  3051.    (set (match_dup 4) (match_dup 5))]
  3052.   "
  3053. { operands[2] = operand_subword (operands[0], 0, 0, DFmode);
  3054.   operands[3] = operand_subword (operands[1], 0, 0, DFmode);
  3055.   operands[4] = operand_subword (operands[0], 1, 0, DFmode);
  3056.   operands[5] = operand_subword (operands[1], 1, 0, DFmode); }")
  3057.  
  3058. ;; Don't have reload use general registers to load a constant.  First,
  3059. ;; it might not work if the output operand has is the equivalent of
  3060. ;; a non-offsettable memref, but also it is less efficient than loading
  3061. ;; the constant into an FP register, since it will probably be used there.
  3062. ;; The "??" is a kludge until we can figure out a more reasonable way
  3063. ;; of handling these non-offsettable values.
  3064. (define_insn ""
  3065.   [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,f,f,m")
  3066.     (match_operand:DF 1 "input_operand" "r,o,r,G,f,m,f"))]
  3067.   "register_operand (operands[0], DFmode)
  3068.    || register_operand (operands[1], DFmode)"
  3069.   "*
  3070. {
  3071.   switch (which_alternative)
  3072.     {
  3073.     case 0:
  3074.       /* We normally copy the low-numbered register first.  However, if
  3075.      the first register operand 0 is the same as the second register of
  3076.      operand 1, we must copy in the opposite order.  */
  3077.       if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
  3078.     return \"{oril %L0,%L1,0|mr %L0,%L1}\;{oril %0,%1,0|mr %0,%1}\";
  3079.       else
  3080.     return \"{oril %0,%1,0|mr %0,%1}\;{oril %L0,%L1,0|mr %L0,%L1}\";
  3081.     case 1:
  3082.       /* If the low-address word is used in the address, we must load it
  3083.      last.  Otherwise, load it first.  Note that we cannot have
  3084.      auto-increment in that case since the address register is known to be
  3085.      dead.  */
  3086.       if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
  3087.                  operands [1], 0))
  3088.     return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
  3089.       else
  3090.     return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
  3091.     case 2:
  3092.       return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
  3093.     case 3:
  3094.       return \"#\";
  3095.     case 4:
  3096.       return \"fmr %0,%1\";
  3097.     case 5:
  3098.       return \"lfd%U1%X1 %0,%1\";
  3099.     case 6:
  3100.       return \"stfd%U0%X0 %1,%0\";
  3101.     }
  3102. }"
  3103.   [(set_attr "type" "*,load,*,*,fp,fpload,*")
  3104.    (set_attr "length" "8,8,8,8,*,*,*")])
  3105.  
  3106. ;; Next come the multi-word integer load and store and the load and store
  3107. ;; multiple insns.
  3108. (define_expand "movdi"
  3109.   [(set (match_operand:DI 0 "general_operand" "")
  3110.     (match_operand:DI 1 "general_operand" ""))]
  3111.   ""
  3112.   "
  3113. {
  3114.   if (GET_CODE (operands[1]) == CONST_DOUBLE
  3115.       || GET_CODE (operands[1]) == CONST_INT)
  3116.     {
  3117.       emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
  3118.               operand_subword (operands[1], 0, 0, DImode));
  3119.       emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
  3120.               operand_subword (operands[1], 1, 0, DImode));
  3121.       DONE;
  3122.     }
  3123.  
  3124.   if (GET_CODE (operands[0]) == MEM)
  3125.     operands[1] = force_reg (DImode, operands[1]);
  3126. }")
  3127.  
  3128. (define_insn ""
  3129.   [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m")
  3130.     (match_operand:DI 1 "input_operand" "r,m,r"))]
  3131.   "gpc_reg_operand (operands[0], DImode)
  3132.    || gpc_reg_operand (operands[1], DImode)"
  3133.   "*
  3134. {
  3135.   switch (which_alternative)
  3136.     {
  3137.     case 0:
  3138.       /* We normally copy the low-numbered register first.  However, if
  3139.      the first register operand 0 is the same as the second register of
  3140.      operand 1, we must copy in the opposite order.  */
  3141.       if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
  3142.     return \"{oril %L0,%L1,0|mr %L0,%L1}\;{oril %0,%1,0|mr %0,%1}\";
  3143.       else
  3144.     return \"{oril %0,%1,0|mr %0,%1}\;{oril %L0,%L1,0|mr %L0,%L1}\";
  3145.     case 1:
  3146.       /* If the low-address word is used in the address, we must load it
  3147.      last.  Otherwise, load it first.  Note that we cannot have
  3148.      auto-increment in that case since the address register is known to be
  3149.      dead.  */
  3150.       if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
  3151.                  operands [1], 0))
  3152.     return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
  3153.       else
  3154.     return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
  3155.     case 2:
  3156.       return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
  3157.     }
  3158. }"
  3159.   [(set_attr "type" "*,load,*")
  3160.    (set_attr "length" "8")])
  3161.  
  3162. ;; TImode is similar, except that we usually want to compute the address into
  3163. ;; a register and use lsi/stsi (the exception is during reload).  MQ is also
  3164. ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
  3165. (define_expand "movti"
  3166.   [(parallel [(set (match_operand:TI 0 "general_operand" "")
  3167.            (match_operand:TI 1 "general_operand" ""))
  3168.           (clobber (scratch:SI))])]
  3169.   "TARGET_POWER"
  3170.   "
  3171. {
  3172.   if (GET_CODE (operands[0]) == MEM)
  3173.     operands[1] = force_reg (TImode, operands[1]);
  3174.  
  3175.   if (GET_CODE (operands[0]) == MEM
  3176.       && GET_CODE (XEXP (operands[0], 0)) != REG
  3177.       && ! reload_in_progress)
  3178.     operands[0] = change_address (operands[0], TImode,
  3179.                   copy_addr_to_reg (XEXP (operands[0], 0)));
  3180.  
  3181.   if (GET_CODE (operands[1]) == MEM
  3182.       && GET_CODE (XEXP (operands[1], 0)) != REG
  3183.       && ! reload_in_progress)
  3184.     operands[1] = change_address (operands[1], TImode,
  3185.                   copy_addr_to_reg (XEXP (operands[1], 0)));
  3186. }")
  3187.  
  3188. ;; We say that MQ is clobbered in the last alternative because the first
  3189. ;; alternative would never get used otherwise since it would need a reload
  3190. ;; while the 2nd alternative would not.  We put memory cases first so they
  3191. ;; are preferred.  Otherwise, we'd try to reload the output instead of
  3192. ;; giving the SCRATCH mq.
  3193. (define_insn ""
  3194.   [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,r,r,r")
  3195.     (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
  3196.    (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
  3197.   "TARGET_POWER && (gpc_reg_operand (operands[0], TImode)
  3198.    || gpc_reg_operand (operands[1], TImode))"
  3199.   "*
  3200. {
  3201.   switch (which_alternative)
  3202.     {
  3203.     case 0:
  3204.       return \"{stsi|stswi} %1,%P0,16\";
  3205.  
  3206.     case 1:
  3207.       return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
  3208.  
  3209.     case 2:
  3210.       /* Normally copy registers with lowest numbered register copied first.
  3211.      But copy in the other order if the first register of the output
  3212.      is the second, third, or fourth register in the input.  */
  3213.       if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
  3214.       && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
  3215.     return \"{oril %Z0,%Z1,0|mr %Z0,%Z1}\;{oril %Y0,%Y1,0|mr %Y0,%Y1}\;{oril %L0,%L1,0|mr %L0,%L1}\;{oril %0,%1,0|mr %0,%1}\";
  3216.       else
  3217.     return \"{oril %0,%1,0|mr %0,%1}\;{oril %L0,%L1,0|mr %L0,%L1}\;{oril %Y0,%Y1,0|mr %Y0,%Y1}\;{oril %Z0,%Z1,0|mr %Z0,%Z1}\";
  3218.     case 3:
  3219.       /* If the address is not used in the output, we can use lsi.  Otherwise,
  3220.      fall through to generating four loads.  */
  3221.       if (! reg_overlap_mentioned_p (operands[0], operands[1]))
  3222.     return \"{lsi|lswi} %0,%P1,16\";
  3223.       /* ... fall through ... */
  3224.     case 4:
  3225.       /* If the address register is the same as the register for the lowest-
  3226.      addressed word, load it last.  Similarly for the next two words.
  3227.      Otherwise load lowest address to highest.  */
  3228.       if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
  3229.                  operands[1], 0))
  3230.     return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
  3231.       else if (refers_to_regno_p (REGNO (operands[0]) + 1,
  3232.                   REGNO (operands[0]) + 2, operands[1], 0))
  3233.     return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
  3234.       else if (refers_to_regno_p (REGNO (operands[0]) + 2,
  3235.                   REGNO (operands[0]) + 3, operands[1], 0))
  3236.     return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
  3237.       else
  3238.     return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
  3239.     }
  3240. }"
  3241.   [(set_attr "type" "*,load,load,*,*")
  3242.    (set_attr "length" "*,16,16,*,16")])
  3243.  
  3244. (define_expand "load_multiple"
  3245.   [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
  3246.               (match_operand:SI 1 "" ""))
  3247.              (use (match_operand:SI 2 "" ""))])]
  3248.   "TARGET_POWER"
  3249.   "
  3250. {
  3251.   int regno;
  3252.   int count;
  3253.   rtx from;
  3254.   int i;
  3255.  
  3256.   /* Support only loading a constant number of fixed-point registers from
  3257.      memory and only bother with this if more than two; the machine
  3258.      doesn't support more than eight.  */
  3259.   if (GET_CODE (operands[2]) != CONST_INT
  3260.       || INTVAL (operands[2]) <= 2
  3261.       || INTVAL (operands[2]) > 8
  3262.       || GET_CODE (operands[1]) != MEM
  3263.       || GET_CODE (operands[0]) != REG
  3264.       || REGNO (operands[0]) >= 32)
  3265.     FAIL;
  3266.  
  3267.   count = INTVAL (operands[2]);
  3268.   regno = REGNO (operands[0]);
  3269.  
  3270.   operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count));
  3271.   from = force_reg (SImode, XEXP (operands[1], 0));
  3272.  
  3273.   for (i = 0; i < count; i++)
  3274.     XVECEXP (operands[3], 0, i)
  3275.       = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
  3276.          gen_rtx (MEM, SImode, plus_constant (from, i * 4)));
  3277. }")
  3278.  
  3279. (define_insn ""
  3280.   [(match_parallel 0 "load_multiple_operation"
  3281.            [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
  3282.              (match_operand:SI 2 "indirect_operand" "Q"))])]
  3283.   "TARGET_POWER"
  3284.   "*
  3285. {
  3286.   /* We have to handle the case where the pseudo used to contain the address
  3287.      is assigned to one of the output registers.  In that case, do the
  3288.      lsi, but then load the correct value.  This is a bit of a mess, but is
  3289.      the best we can do.
  3290.      We set the length attribute to the maximum possible size (8 bytes).  */
  3291.   static char result[100];
  3292.   char newload[40];
  3293.   int i;
  3294.  
  3295.   strcpy (result, \"{lsi|lswi} %1,%P2,%N0\");
  3296.   for (i = 0; i < XVECLEN (operands[0], 0); i++)
  3297.     if (refers_to_regno_p (REGNO (operands[1]) + i,
  3298.                REGNO (operands[1]) + i + 1, operands[2], 0))
  3299.       {
  3300.     sprintf (newload, \"\;{l|lwz} %d,%d(%d)\",
  3301.          REGNO (operands[1]) + i,
  3302.          i * 4, REGNO (XEXP (operands[2], 0)));
  3303.     strcat (result, newload);
  3304.       }
  3305.  
  3306.   return result;
  3307. }"
  3308.   [(set_attr "type" "load")
  3309.    (set_attr "length" "8")])
  3310.  
  3311.  
  3312. (define_expand "store_multiple"
  3313.   [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
  3314.               (match_operand:SI 1 "" ""))
  3315.              (clobber (scratch:SI))
  3316.              (use (match_operand:SI 2 "" ""))])]
  3317.   "TARGET_POWER"
  3318.   "
  3319. {
  3320.   int regno;
  3321.   int count;
  3322.   rtx to;
  3323.   int i;
  3324.  
  3325.   /* Support only storing a constant number of fixed-point registers to
  3326.      memory and only bother with this if more than two; the machine
  3327.      doesn't support more than eight.  */
  3328.   if (GET_CODE (operands[2]) != CONST_INT
  3329.       || INTVAL (operands[2]) <= 2
  3330.       || INTVAL (operands[2]) > 8
  3331.       || GET_CODE (operands[0]) != MEM
  3332.       || GET_CODE (operands[1]) != REG
  3333.       || REGNO (operands[1]) >= 32)
  3334.     FAIL;
  3335.  
  3336.   count = INTVAL (operands[2]);
  3337.   regno = REGNO (operands[1]);
  3338.  
  3339.   operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
  3340.   to = force_reg (SImode, XEXP (operands[0], 0));
  3341.  
  3342.   XVECEXP (operands[3], 0, 0)
  3343.     = gen_rtx (SET, VOIDmode, gen_rtx (MEM, SImode, to), operands[1]);
  3344.   XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode,
  3345.                           gen_rtx (SCRATCH, SImode));
  3346.  
  3347.   for (i = 1; i < count; i++)
  3348.     XVECEXP (operands[3], 0, i + 1)
  3349.       = gen_rtx (SET, VOIDmode,
  3350.          gen_rtx (MEM, SImode, plus_constant (to, i * 4)),
  3351.          gen_rtx (REG, SImode, regno + i));
  3352. }")
  3353.  
  3354. (define_insn ""
  3355.   [(match_parallel 0 "store_multiple_operation"
  3356.            [(set (match_operand:SI 1 "indirect_operand" "=Q")
  3357.              (match_operand:SI 2 "gpc_reg_operand" "r"))
  3358.             (clobber (match_scratch:SI 3 "=q"))])]
  3359.   "TARGET_POWER"
  3360.   "{stsi|stswi} %2,%P1,%O0")
  3361.  
  3362. ;; Define insns that do load or store with update.  Some of these we can 
  3363. ;; get by using pre-decrement or pre-increment, but the hardware can also
  3364. ;; do cases where the increment is not the size of the object.
  3365. ;;
  3366. ;; In all these cases, we use operands 0 and 1 for the register being
  3367. ;; incremented because those are the operands that local-alloc will
  3368. ;; tie and these are the pair most likely to be tieable (and the ones
  3369. ;; that will benefit the most).
  3370.  
  3371. (define_insn ""
  3372.   [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
  3373.     (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3374.              (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
  3375.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3376.     (plus:SI (match_dup 1) (match_dup 2)))]
  3377.   ""
  3378.   "@
  3379.    {lux|lwzux} %3,%0,%2
  3380.    {lu|lwzu} %3,%2(%0)"
  3381.   [(set_attr "type" "load")])
  3382.  
  3383. (define_insn ""
  3384.   [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3385.              (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  3386.     (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  3387.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3388.     (plus:SI (match_dup 1) (match_dup 2)))]
  3389.   ""
  3390.   "@
  3391.    {stux|stwux} %3,%0,%2
  3392.    {stu|stwu} %3,%2(%0)")
  3393.  
  3394. (define_insn ""
  3395.   [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
  3396.     (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3397.              (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
  3398.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3399.     (plus:SI (match_dup 1) (match_dup 2)))]
  3400.   ""
  3401.   "@
  3402.    lhzux %3,%0,%2
  3403.    lhzu %3,%2(%0)"
  3404.   [(set_attr "type" "load")])
  3405.  
  3406. (define_insn ""
  3407.   [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
  3408.     (zero_extend:SI
  3409.      (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3410.               (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
  3411.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3412.     (plus:SI (match_dup 1) (match_dup 2)))]
  3413.   ""
  3414.   "@
  3415.    lhzux %3,%0,%2
  3416.    lhzu %3,%2(%0)"
  3417.   [(set_attr "type" "load")])
  3418.  
  3419. (define_insn ""
  3420.   [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
  3421.     (sign_extend:SI
  3422.      (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3423.               (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
  3424.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3425.     (plus:SI (match_dup 1) (match_dup 2)))]
  3426.   ""
  3427.   "@
  3428.    lhaux %3,%0,%2
  3429.    lhau %3,%2(%0)"
  3430.   [(set_attr "type" "load")])
  3431.  
  3432. (define_insn ""
  3433.   [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3434.              (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  3435.     (match_operand:HI 3 "gpc_reg_operand" "r,r"))
  3436.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3437.     (plus:SI (match_dup 1) (match_dup 2)))]
  3438.   ""
  3439.   "@
  3440.    sthux %3,%0,%2
  3441.    sthu %3,%2(%0)")
  3442.  
  3443. (define_insn ""
  3444.   [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
  3445.     (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3446.              (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
  3447.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3448.     (plus:SI (match_dup 1) (match_dup 2)))]
  3449.   ""
  3450.   "@
  3451.    lbzux %3,%0,%2
  3452.    lbzu %3,%2(%0)"
  3453.   [(set_attr "type" "load")])
  3454.  
  3455. (define_insn ""
  3456.   [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
  3457.     (zero_extend:SI
  3458.      (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3459.               (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
  3460.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3461.     (plus:SI (match_dup 1) (match_dup 2)))]
  3462.   ""
  3463.   "@
  3464.    lbzux %3,%0,%2
  3465.    lbzu %3,%2(%0)"
  3466.   [(set_attr "type" "load")])
  3467.  
  3468. (define_insn ""
  3469.   [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3470.              (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  3471.     (match_operand:QI 3 "gpc_reg_operand" "r,r"))
  3472.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3473.     (plus:SI (match_dup 1) (match_dup 2)))]
  3474.   ""
  3475.   "@
  3476.    stbux %3,%0,%2
  3477.    stbu %3,%2(%0)")
  3478.  
  3479. (define_insn ""
  3480.   [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
  3481.     (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3482.              (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
  3483.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3484.     (plus:SI (match_dup 1) (match_dup 2)))]
  3485.   ""
  3486.   "@
  3487.    lfsux %3,%0,%2
  3488.    lfsu %3,%2(%0)"
  3489.   [(set_attr "type" "fpload")])
  3490.  
  3491. (define_insn ""
  3492.   [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3493.              (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  3494.     (match_operand:SF 3 "gpc_reg_operand" "f,f"))
  3495.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3496.     (plus:SI (match_dup 1) (match_dup 2)))]
  3497.   ""
  3498.   "@
  3499.    frsp %3,%3\;stfsux %3,%0,%2
  3500.    frsp %3,%3\;stfsu %3,%2(%0)")
  3501.  
  3502. (define_insn ""
  3503.   [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
  3504.     (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3505.              (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
  3506.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3507.     (plus:SI (match_dup 1) (match_dup 2)))]
  3508.   ""
  3509.   "@
  3510.    lfdux %3,%0,%2
  3511.    lfdu %3,%2(%0)"
  3512.   [(set_attr "type" "fpload")])
  3513.  
  3514. (define_insn ""
  3515.   [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  3516.              (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  3517.     (match_operand:DF 3 "gpc_reg_operand" "f,f"))
  3518.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  3519.     (plus:SI (match_dup 1) (match_dup 2)))]
  3520.   ""
  3521.   "@
  3522.    stfdux %3,%0,%2
  3523.    stfdu %3,%2(%0)")
  3524.  
  3525. ;; Next come insns related to the calling sequence.
  3526. ;;
  3527. ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
  3528. ;; We move the back-chain and decrement the stack pointer.  
  3529.  
  3530. (define_expand "allocate_stack"
  3531.   [(set (reg:SI 1)
  3532.     (minus:SI (reg:SI 1) (match_operand:SI 0 "reg_or_short_operand" "")))]
  3533.   ""
  3534.   "
  3535. { rtx chain = gen_reg_rtx (SImode);
  3536.   rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx);
  3537.  
  3538.   emit_move_insn (chain, stack_bot);
  3539.   emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, operands[0]));
  3540.   emit_move_insn (stack_bot, chain);
  3541.   DONE;
  3542. }")
  3543.  
  3544. ;; These patterns say how to save and restore the stack pointer.  We need not
  3545. ;; save the stack pointer at function level since we are careful to
  3546. ;; preserve the backchain.  At block level, we have to restore the backchain
  3547. ;; when we restore the stack pointer.
  3548. ;;
  3549. ;; For nonlocal gotos, we must save both the stack pointer and its
  3550. ;; backchain and restore both.  Note that in the nonlocal case, the
  3551. ;; save area is a memory location.
  3552.  
  3553. (define_expand "save_stack_function"
  3554.   [(use (const_int 0))]
  3555.   ""
  3556.   "")
  3557.  
  3558. (define_expand "restore_stack_function"
  3559.   [(use (const_int 0))]
  3560.   ""
  3561.   "")
  3562.  
  3563. (define_expand "restore_stack_block"
  3564.   [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" "")))
  3565.    (set (match_dup 0) (match_operand:SI 1 "register_operand" ""))
  3566.    (set (mem:SI (match_dup 0)) (match_dup 2))]
  3567.   ""
  3568.   "
  3569. { operands[2] = gen_reg_rtx (SImode); }")
  3570.  
  3571. (define_expand "save_stack_nonlocal"
  3572.   [(match_operand:DI 0 "memory_operand" "")
  3573.    (match_operand:SI 1 "register_operand" "")]
  3574.   ""
  3575.   "
  3576. {
  3577.   rtx temp = gen_reg_rtx (SImode);
  3578.  
  3579.   /* Copy the backchain to the first word, sp to the second.  */
  3580.   emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1]));
  3581.   emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp);
  3582.   emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]);
  3583.   DONE;
  3584. }")
  3585.           
  3586. (define_expand "restore_stack_nonlocal"
  3587.   [(match_operand:SI 0 "register_operand" "")
  3588.    (match_operand:DI 1 "memory_operand" "")]
  3589.   ""
  3590.   "
  3591. {
  3592.   rtx temp = gen_reg_rtx (SImode);
  3593.  
  3594.   /* Restore the backchain from the first word, sp from the second.  */
  3595.   emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode));
  3596.   emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode));
  3597.   emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp);
  3598.   DONE;
  3599. }")
  3600.  
  3601. ;; A function pointer is a pointer to a data area whose first word contains
  3602. ;; the actual address of the function, whose second word contains a pointer
  3603. ;; to its TOC, and whose third word contains a value to place in the static
  3604. ;; chain register (r11).  Note that if we load the static chain, our 
  3605. ;; "trampoline" need not have any executable code.
  3606. ;;
  3607. ;; operands[0] is an SImode pseudo in which we place the address of the
  3608. ;;            function.
  3609. ;; operands[1] is the address of data area of the function to call
  3610.  
  3611. (define_expand "call_via_ptr"
  3612.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  3613.     (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
  3614.    (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
  3615.     (reg:SI 2))
  3616.    (set (reg:SI 2)
  3617.     (mem:SI (plus:SI (match_dup 1)
  3618.              (const_int 4))))
  3619.    (set (reg:SI 11)
  3620.     (mem:SI (plus:SI (match_dup 1)
  3621.              (const_int 8))))
  3622.    (use (reg:SI 2))
  3623.    (use (reg:SI 11))]
  3624.   ""
  3625.   "")
  3626.  
  3627. (define_expand "call"
  3628.   [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
  3629.             (match_operand 1 "" ""))
  3630.           (clobber (scratch:SI))])]
  3631.   ""
  3632.   "
  3633. {
  3634.   if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
  3635.     abort ();
  3636.  
  3637.   operands[0] = XEXP (operands[0], 0);
  3638.   if (GET_CODE (operands[0]) != SYMBOL_REF)
  3639.     {
  3640.       rtx temp = gen_reg_rtx (SImode);
  3641.  
  3642.       emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[0])));
  3643.       operands[0] = temp;
  3644.     }
  3645. }")
  3646.  
  3647. (define_expand "call_value"
  3648.   [(parallel [(set (match_operand 0 "" "")
  3649.            (call (mem:SI (match_operand:SI 1 "address_operand" ""))
  3650.              (match_operand 2 "" "")))
  3651.           (clobber (scratch:SI))])]
  3652.   ""
  3653.   "
  3654. {
  3655.   if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
  3656.     abort ();
  3657.  
  3658.   operands[1] = XEXP (operands[1], 0);
  3659.   if (GET_CODE (operands[1]) != SYMBOL_REF)
  3660.     {
  3661.       rtx temp = gen_reg_rtx (SImode);
  3662.  
  3663.       emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[1])));
  3664.       operands[1] = temp;
  3665.     }
  3666. }")
  3667.  
  3668. ;; Call to function in current module.  No TOC pointer reload needed.
  3669.  
  3670. (define_insn ""
  3671.   [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s"))
  3672.      (match_operand 1 "" "g"))
  3673.    (clobber (match_scratch:SI 2 "=l"))]
  3674.   ""
  3675.   "bl %z0")
  3676.  
  3677. ;; Call to function which may be in another module.  Restore the TOC
  3678. ;; pointer (r2) after the call.
  3679.  
  3680. (define_insn ""
  3681.   [(call (mem:SI (match_operand:SI 0 "call_operand" "l,s"))
  3682.      (match_operand 1 "" "fg,fg"))
  3683.    (clobber (match_scratch:SI 2 "=l,l"))]
  3684.   ""
  3685.   "@
  3686.    {brl|blrl}\;{l|lwz} 2,20(1)
  3687.    bl %z0\;%."
  3688.   [(set_attr "length" "8")])
  3689.  
  3690. (define_insn ""
  3691.   [(set (match_operand 0 "" "=fg")
  3692.     (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s"))
  3693.           (match_operand 2 "" "g")))
  3694.    (clobber (match_scratch:SI 3 "=l"))]
  3695.   ""
  3696.   "bl %z1")
  3697.  
  3698. (define_insn ""
  3699.   [(set (match_operand 0 "" "=fg,fg")
  3700.     (call (mem:SI (match_operand:SI 1 "call_operand" "l,s"))
  3701.           (match_operand 2 "" "fg,fg")))
  3702.    (clobber (match_scratch:SI 3 "=l,l"))]
  3703.   ""
  3704.   "@
  3705.    {brl|blrl}\;{l|lwz} 2,20(1)
  3706.    bl %z1\;%."
  3707.   [(set_attr "length" "8")])
  3708.  
  3709. ;; Call subroutine returning any type.
  3710.  
  3711. (define_expand "untyped_call"
  3712.   [(parallel [(call (match_operand 0 "" "")
  3713.             (const_int 0))
  3714.           (match_operand 1 "" "")
  3715.           (match_operand 2 "" "")])]
  3716.   ""
  3717.   "
  3718. {
  3719.   int i;
  3720.  
  3721.   emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
  3722.  
  3723.   for (i = 0; i < XVECLEN (operands[2], 0); i++)
  3724.     {
  3725.       rtx set = XVECEXP (operands[2], 0, i);
  3726.       emit_move_insn (SET_DEST (set), SET_SRC (set));
  3727.     }
  3728.  
  3729.   /* The optimizer does not know that the call sets the function value
  3730.      registers we stored in the result block.  We avoid problems by
  3731.      claiming that all hard registers are used and clobbered at this
  3732.      point.  */
  3733.   emit_insn (gen_blockage ());
  3734.  
  3735.   DONE;
  3736. }")
  3737.  
  3738. ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
  3739. ;; all of memory.  This blocks insns from being moved across this point.
  3740.  
  3741. (define_insn "blockage"
  3742.   [(unspec_volatile [(const_int 0)] 0)]
  3743.   ""
  3744.   "")
  3745.  
  3746. ;; Compare insns are next.  Note that the RS/6000 has two types of compares,
  3747. ;; signed & unsigned, and one type of branch.  
  3748. ;;
  3749. ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
  3750. ;; insns, and branches.  We store the operands of compares until we see
  3751. ;; how it is used.
  3752. (define_expand "cmpsi"
  3753.   [(set (cc0)
  3754.         (compare (match_operand:SI 0 "gpc_reg_operand" "")
  3755.            (match_operand:SI 1 "reg_or_short_operand" "")))]
  3756.   ""
  3757.   "
  3758. {
  3759.   /* Take care of the possibility that operands[1] might be negative but
  3760.      this might be a logical operation.  That insn doesn't exist.  */
  3761.   if (GET_CODE (operands[1]) == CONST_INT
  3762.       && INTVAL (operands[1]) < 0)
  3763.     operands[1] = force_reg (SImode, operands[1]);
  3764.  
  3765.   rs6000_compare_op0 = operands[0];
  3766.   rs6000_compare_op1 = operands[1];
  3767.   rs6000_compare_fp_p = 0;
  3768.   DONE;
  3769. }")
  3770.  
  3771. (define_expand "cmpsf"
  3772.   [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
  3773.                (match_operand:SF 1 "gpc_reg_operand" "")))]
  3774.   ""
  3775.   "
  3776. {
  3777.   rs6000_compare_op0 = operands[0];
  3778.   rs6000_compare_op1 = operands[1];
  3779.   rs6000_compare_fp_p = 1;
  3780.   DONE;
  3781. }")
  3782.  
  3783. (define_expand "cmpdf"
  3784.   [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
  3785.                (match_operand:DF 1 "gpc_reg_operand" "")))]
  3786.   ""
  3787.   "
  3788. {
  3789.   rs6000_compare_op0 = operands[0];
  3790.   rs6000_compare_op1 = operands[1];
  3791.   rs6000_compare_fp_p = 1;
  3792.   DONE;
  3793. }")
  3794.  
  3795. (define_expand "beq"
  3796.   [(set (match_dup 2) (match_dup 1))
  3797.    (set (pc)
  3798.     (if_then_else (eq (match_dup 2)
  3799.               (const_int 0))
  3800.               (label_ref (match_operand 0 "" ""))
  3801.               (pc)))]
  3802.   ""
  3803.   "
  3804. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3805.   operands[1] = gen_rtx (COMPARE, mode,
  3806.              rs6000_compare_op0, rs6000_compare_op1);
  3807.   operands[2] = gen_reg_rtx (mode);
  3808. }")
  3809.  
  3810. (define_expand "bne"
  3811.   [(set (match_dup 2) (match_dup 1))
  3812.    (set (pc)
  3813.     (if_then_else (ne (match_dup 2)
  3814.               (const_int 0))
  3815.               (label_ref (match_operand 0 "" ""))
  3816.               (pc)))]
  3817.   ""
  3818.   "
  3819. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3820.   operands[1] = gen_rtx (COMPARE, mode,
  3821.              rs6000_compare_op0, rs6000_compare_op1);
  3822.   operands[2] = gen_reg_rtx (mode);
  3823. }")
  3824.  
  3825. (define_expand "blt"
  3826.   [(set (match_dup 2) (match_dup 1))
  3827.    (set (pc)
  3828.     (if_then_else (lt (match_dup 2)
  3829.               (const_int 0))
  3830.               (label_ref (match_operand 0 "" ""))
  3831.               (pc)))]
  3832.   ""
  3833.   "
  3834. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3835.   operands[1] = gen_rtx (COMPARE, mode,
  3836.              rs6000_compare_op0, rs6000_compare_op1);
  3837.   operands[2] = gen_reg_rtx (mode);
  3838. }")
  3839.  
  3840. (define_expand "bgt"
  3841.   [(set (match_dup 2) (match_dup 1))
  3842.    (set (pc)
  3843.     (if_then_else (gt (match_dup 2)
  3844.               (const_int 0))
  3845.               (label_ref (match_operand 0 "" ""))
  3846.               (pc)))]
  3847.   ""
  3848.   "
  3849. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3850.   operands[1] = gen_rtx (COMPARE, mode,
  3851.              rs6000_compare_op0, rs6000_compare_op1);
  3852.   operands[2] = gen_reg_rtx (mode);
  3853. }")
  3854.  
  3855. (define_expand "ble"
  3856.   [(set (match_dup 2) (match_dup 1))
  3857.    (set (pc)
  3858.     (if_then_else (le (match_dup 2)
  3859.               (const_int 0))
  3860.               (label_ref (match_operand 0 "" ""))
  3861.               (pc)))]
  3862.   ""
  3863.   "
  3864. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3865.   operands[1] = gen_rtx (COMPARE, mode,
  3866.              rs6000_compare_op0, rs6000_compare_op1);
  3867.   operands[2] = gen_reg_rtx (mode);
  3868. }")
  3869.  
  3870. (define_expand "bge"
  3871.   [(set (match_dup 2) (match_dup 1))
  3872.    (set (pc)
  3873.     (if_then_else (ge (match_dup 2)
  3874.               (const_int 0))
  3875.               (label_ref (match_operand 0 "" ""))
  3876.               (pc)))]
  3877.   ""
  3878.   "
  3879. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3880.   operands[1] = gen_rtx (COMPARE, mode,
  3881.              rs6000_compare_op0, rs6000_compare_op1);
  3882.   operands[2] = gen_reg_rtx (mode);
  3883. }")
  3884.  
  3885. (define_expand "bgtu"
  3886.   [(set (match_dup 2) (match_dup 1))
  3887.    (set (pc)
  3888.     (if_then_else (gtu (match_dup 2)
  3889.                (const_int 0))
  3890.               (label_ref (match_operand 0 "" ""))
  3891.               (pc)))]
  3892.   ""
  3893.   "
  3894. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3895.              rs6000_compare_op0, rs6000_compare_op1);
  3896.   operands[2] = gen_reg_rtx (CCUNSmode);
  3897. }")
  3898.  
  3899. (define_expand "bltu"
  3900.   [(set (match_dup 2) (match_dup 1))
  3901.    (set (pc)
  3902.     (if_then_else (ltu (match_dup 2)
  3903.                (const_int 0))
  3904.               (label_ref (match_operand 0 "" ""))
  3905.               (pc)))]
  3906.   ""
  3907.   "
  3908. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3909.              rs6000_compare_op0, rs6000_compare_op1);
  3910.   operands[2] = gen_reg_rtx (CCUNSmode);
  3911. }")
  3912.  
  3913. (define_expand "bgeu"
  3914.   [(set (match_dup 2) (match_dup 1))
  3915.    (set (pc)
  3916.     (if_then_else (geu (match_dup 2)
  3917.                (const_int 0))
  3918.               (label_ref (match_operand 0 "" ""))
  3919.               (pc)))]
  3920.   ""
  3921.   "
  3922. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3923.              rs6000_compare_op0, rs6000_compare_op1);
  3924.   operands[2] = gen_reg_rtx (CCUNSmode);
  3925. }")
  3926.  
  3927. (define_expand "bleu"
  3928.   [(set (match_dup 2) (match_dup 1))
  3929.    (set (pc)
  3930.     (if_then_else (leu (match_dup 2)
  3931.                (const_int 0))
  3932.               (label_ref (match_operand 0 "" ""))
  3933.               (pc)))]
  3934.   ""
  3935.   "
  3936. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3937.              rs6000_compare_op0, rs6000_compare_op1);
  3938.   operands[2] = gen_reg_rtx (CCUNSmode);
  3939. }")
  3940.  
  3941. ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
  3942. ;; For SEQ, likewise, except that comparisons with zero should be done
  3943. ;; with an scc insns.  However, due to the order that combine see the
  3944. ;; resulting insns, we must, in fact, allow SEQ for integers.  Fail in
  3945. ;; the cases we don't want to handle.
  3946. (define_expand "seq"
  3947.   [(set (match_dup 2) (match_dup 1))
  3948.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3949.     (eq:SI (match_dup 2) (const_int 0)))]
  3950.   ""
  3951.   "
  3952. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3953.   operands[1] = gen_rtx (COMPARE, mode,
  3954.              rs6000_compare_op0, rs6000_compare_op1);
  3955.   operands[2] = gen_reg_rtx (mode);
  3956. }")
  3957.  
  3958. (define_expand "sne"
  3959.   [(set (match_dup 2) (match_dup 1))
  3960.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3961.     (ne:SI (match_dup 2) (const_int 0)))]
  3962.   ""
  3963.   "
  3964. { if (! rs6000_compare_fp_p)
  3965.     FAIL;
  3966.  
  3967.   operands[1] = gen_rtx (COMPARE, CCFPmode,
  3968.              rs6000_compare_op0, rs6000_compare_op1);
  3969.   operands[2] = gen_reg_rtx (CCFPmode);
  3970. }")
  3971.  
  3972. ;; A > 0 is best done using the portable sequence, so fail in that case.
  3973. (define_expand "sgt"
  3974.   [(set (match_dup 2) (match_dup 1))
  3975.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3976.     (gt:SI (match_dup 2) (const_int 0)))]
  3977.   ""
  3978.   "
  3979. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3980.  
  3981.   if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
  3982.     FAIL;
  3983.  
  3984.   operands[1] = gen_rtx (COMPARE, mode,
  3985.              rs6000_compare_op0, rs6000_compare_op1);
  3986.   operands[2] = gen_reg_rtx (mode);
  3987. }")
  3988.  
  3989. ;; A < 0 is best done in the portable way for A an integer.
  3990. (define_expand "slt"
  3991.   [(set (match_dup 2) (match_dup 1))
  3992.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3993.     (lt:SI (match_dup 2) (const_int 0)))]
  3994.   ""
  3995.   "
  3996. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3997.  
  3998.   if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
  3999.     FAIL;
  4000.  
  4001.   operands[1] = gen_rtx (COMPARE, mode,
  4002.              rs6000_compare_op0, rs6000_compare_op1);
  4003.   operands[2] = gen_reg_rtx (mode);
  4004. }")
  4005.  
  4006. (define_expand "sge"
  4007.   [(set (match_dup 2) (match_dup 1))
  4008.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  4009.     (ge:SI (match_dup 2) (const_int 0)))]
  4010.   ""
  4011.   "
  4012. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  4013.   operands[1] = gen_rtx (COMPARE, mode,
  4014.              rs6000_compare_op0, rs6000_compare_op1);
  4015.   operands[2] = gen_reg_rtx (mode);
  4016. }")
  4017.  
  4018. ;; A <= 0 is best done the portable way for A an integer.
  4019. (define_expand "sle"
  4020.   [(set (match_dup 2) (match_dup 1))
  4021.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  4022.     (le:SI (match_dup 2) (const_int 0)))]
  4023.   ""
  4024.   "
  4025. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  4026.  
  4027.   if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
  4028.     FAIL;
  4029.  
  4030.   operands[1] = gen_rtx (COMPARE, mode,
  4031.              rs6000_compare_op0, rs6000_compare_op1);
  4032.   operands[2] = gen_reg_rtx (mode);
  4033. }")
  4034.  
  4035. (define_expand "sgtu"
  4036.   [(set (match_dup 2) (match_dup 1))
  4037.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  4038.     (gtu:SI (match_dup 2) (const_int 0)))]
  4039.   ""
  4040.   "
  4041. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  4042.              rs6000_compare_op0, rs6000_compare_op1);
  4043.   operands[2] = gen_reg_rtx (CCUNSmode);
  4044. }")
  4045.  
  4046. (define_expand "sltu"
  4047.   [(set (match_dup 2) (match_dup 1))
  4048.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  4049.     (ltu:SI (match_dup 2) (const_int 0)))]
  4050.   ""
  4051.   "
  4052. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  4053.              rs6000_compare_op0, rs6000_compare_op1);
  4054.   operands[2] = gen_reg_rtx (CCUNSmode);
  4055. }")
  4056.  
  4057. (define_expand "sgeu"
  4058.   [(set (match_dup 2) (match_dup 1))
  4059.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  4060.     (geu:SI (match_dup 2) (const_int 0)))]
  4061.   ""
  4062.   "
  4063. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  4064.              rs6000_compare_op0, rs6000_compare_op1);
  4065.   operands[2] = gen_reg_rtx (CCUNSmode);
  4066. }")
  4067.  
  4068. (define_expand "sleu"
  4069.   [(set (match_dup 2) (match_dup 1))
  4070.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  4071.     (leu:SI (match_dup 2) (const_int 0)))]
  4072.   ""
  4073.   "
  4074. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  4075.              rs6000_compare_op0, rs6000_compare_op1);
  4076.   operands[2] = gen_reg_rtx (CCUNSmode);
  4077. }")
  4078.  
  4079. ;; Here are the actual compare insns.
  4080. (define_insn ""
  4081.   [(set (match_operand:CC 0 "cc_reg_operand" "=y")
  4082.     (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
  4083.             (match_operand:SI 2 "reg_or_short_operand" "rI")))]
  4084.   ""
  4085.   "{cmp%I2|cmpw%I2} %0,%1,%2"
  4086.   [(set_attr "type" "compare")])
  4087.  
  4088. ;; If we are comparing a register for equality with a large constant,
  4089. ;; we can do this with an XOR followed by a compare.  But we need a scratch
  4090. ;; register for the result of the XOR.
  4091.  
  4092. (define_split
  4093.   [(set (match_operand:CC 0 "cc_reg_operand" "")
  4094.     (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
  4095.             (match_operand:SI 2 "non_short_cint_operand" "")))
  4096.    (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
  4097.   "find_single_use (operands[0], insn, 0)
  4098.    && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
  4099.        || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
  4100.   [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
  4101.    (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
  4102.   "
  4103. {
  4104.   /* Get the constant we are comparing against, C,  and see what it looks like
  4105.      sign-extended to 16 bits.  Then see what constant could be XOR'ed
  4106.      with C to get the sign-extended value.  */
  4107.  
  4108.   int c = INTVAL (operands[2]);
  4109.   int sextc = (c << 16) >> 16;
  4110.   int xorv = c ^ sextc;
  4111.  
  4112.   operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
  4113.   operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
  4114. }")
  4115.  
  4116. (define_insn ""
  4117.   [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
  4118.     (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
  4119.                (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
  4120.   ""
  4121.   "{cmpl%I2|cmplw%I2} %0,%1,%W2"
  4122.   [(set_attr "type" "compare")])
  4123.  
  4124. ;; The following two insns don't exist as single insns, but if we provide
  4125. ;; them, we can swap an add and compare, which will enable us to overlap more
  4126. ;; of the required delay between a compare and branch.  We generate code for
  4127. ;; them by splitting.
  4128.  
  4129. (define_insn ""
  4130.   [(set (match_operand:CC 3 "cc_reg_operand" "=y")
  4131.     (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
  4132.             (match_operand:SI 2 "short_cint_operand" "i")))
  4133.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4134.     (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
  4135.   ""
  4136.   "#"
  4137.   [(set_attr "length" "8")])
  4138.    
  4139. (define_insn ""
  4140.   [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
  4141.     (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
  4142.                (match_operand:SI 2 "u_short_cint_operand" "i")))
  4143.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4144.     (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
  4145.   ""
  4146.   "#"
  4147.   [(set_attr "length" "8")])
  4148.    
  4149. (define_split
  4150.   [(set (match_operand:CC 3 "cc_reg_operand" "")
  4151.     (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
  4152.             (match_operand:SI 2 "short_cint_operand" "")))
  4153.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  4154.     (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
  4155.   ""
  4156.   [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
  4157.    (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
  4158.  
  4159. (define_split
  4160.   [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
  4161.     (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
  4162.                (match_operand:SI 2 "u_short_cint_operand" "")))
  4163.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  4164.     (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
  4165.   ""
  4166.   [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
  4167.    (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
  4168.  
  4169. (define_insn ""
  4170.   [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
  4171.     (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
  4172.               (match_operand:SF 2 "gpc_reg_operand" "f")))]
  4173.   ""
  4174.   "fcmpu %0,%1,%2"
  4175.   [(set_attr "type" "fpcompare")])
  4176.  
  4177. (define_insn ""
  4178.   [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
  4179.     (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
  4180.               (match_operand:DF 2 "gpc_reg_operand" "f")))]
  4181.   ""
  4182.   "fcmpu %0,%1,%2"
  4183.   [(set_attr "type" "fpcompare")])
  4184.  
  4185. ;; Now we have the scc insns.  We can do some combinations because of the
  4186. ;; way the machine works.
  4187. ;;
  4188. ;; Note that this is probably faster if we can put an insn between the
  4189. ;; mfcr and rlinm, but this is tricky.  Let's leave it for now.  In most
  4190. ;; cases the insns below which don't use an intermediate CR field will
  4191. ;; be used instead.
  4192. (define_insn ""
  4193.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4194.     (match_operator:SI 1 "scc_comparison_operator"
  4195.                [(match_operand 2 "cc_reg_operand" "y")
  4196.                 (const_int 0)]))]
  4197.   ""
  4198.   "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
  4199.   [(set_attr "length" "12")])
  4200.  
  4201. (define_insn ""
  4202.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4203.     (compare:CC (match_operator:SI 1 "scc_comparison_operator"
  4204.                        [(match_operand 2 "cc_reg_operand" "y")
  4205.                     (const_int 0)])
  4206.             (const_int 0)))
  4207.    (set (match_operand:SI 3 "gpc_reg_operand" "=r")
  4208.     (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
  4209.   ""
  4210.   "%D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1"
  4211.   [(set_attr "type" "delayed_compare")
  4212.    (set_attr "length" "12")])
  4213.  
  4214. (define_insn ""
  4215.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4216.     (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
  4217.                       [(match_operand 2 "cc_reg_operand" "y")
  4218.                        (const_int 0)])
  4219.            (match_operand:SI 3 "const_int_operand" "n")))]
  4220.   ""
  4221.   "*
  4222. {
  4223.   int is_bit = ccr_bit (operands[1], 1);
  4224.   int put_bit = 31 - (INTVAL (operands[3]) & 31);
  4225.   int count;
  4226.  
  4227.   if (is_bit >= put_bit)
  4228.     count = is_bit - put_bit;
  4229.   else
  4230.     count = 32 - (put_bit - is_bit);
  4231.  
  4232.   operands[4] = gen_rtx (CONST_INT, VOIDmode, count);
  4233.   operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit);
  4234.  
  4235.   return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
  4236. }"
  4237.  [(set_attr "length" "12")])
  4238.  
  4239. (define_insn ""
  4240.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4241.     (compare:CC
  4242.      (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
  4243.                        [(match_operand 2 "cc_reg_operand" "y")
  4244.                     (const_int 0)])
  4245.             (match_operand:SI 3 "const_int_operand" "n"))
  4246.      (const_int 0)))
  4247.    (set (match_operand:SI 4 "gpc_reg_operand" "=r")
  4248.     (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
  4249.            (match_dup 3)))]
  4250.   ""
  4251.   "*
  4252. {
  4253.   int is_bit = ccr_bit (operands[1], 1);
  4254.   int put_bit = 31 - (INTVAL (operands[3]) & 31);
  4255.   int count;
  4256.  
  4257.   if (is_bit >= put_bit)
  4258.     count = is_bit - put_bit;
  4259.   else
  4260.     count = 32 - (put_bit - is_bit);
  4261.  
  4262.   operands[5] = gen_rtx (CONST_INT, VOIDmode, count);
  4263.   operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit);
  4264.  
  4265.   return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
  4266. }"
  4267.   [(set_attr "type" "delayed_compare")
  4268.    (set_attr "length" "12")])
  4269.  
  4270. ;; If we are comparing the result of two comparisons, this can be done
  4271. ;; using creqv or crxor.
  4272.  
  4273. (define_insn ""
  4274.   [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
  4275.     (compare:CCEQ (match_operator 1 "scc_comparison_operator"
  4276.                   [(match_operand 2 "cc_reg_operand" "y")
  4277.                    (const_int 0)])
  4278.               (match_operator 3 "scc_comparison_operator"
  4279.                   [(match_operand 4 "cc_reg_operand" "y")
  4280.                    (const_int 0)])))]
  4281.   "REGNO (operands[2]) != REGNO (operands[4])"
  4282.   "*
  4283. {
  4284.   enum rtx_code code1, code2;
  4285.  
  4286.   code1 = GET_CODE (operands[1]);
  4287.   code2 = GET_CODE (operands[3]);
  4288.  
  4289.   if ((code1 == EQ || code1 == LT || code1 == GT
  4290.        || code1 == LTU || code1 == GTU
  4291.        || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
  4292.       !=
  4293.       (code2 == EQ || code2 == LT || code2 == GT
  4294.        || code2 == LTU || code2 == GTU
  4295.        || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
  4296.     return \"%C1%C3crxor %E0,%j1,%j3\";
  4297.   else
  4298.     return \"%C1%C3creqv %E0,%j1,%j3\";
  4299. }"
  4300.   [(set_attr "length" "12")])
  4301.  
  4302. ;; There is a 3 cycle delay between consecutive mfcr instructions
  4303. ;; so it is useful to combine 2 scc instructions to use only one mfcr.
  4304.  
  4305. (define_peephole
  4306.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4307.     (match_operator:SI 1 "scc_comparison_operator"
  4308.                [(match_operand 2 "cc_reg_operand" "y")
  4309.                 (const_int 0)]))
  4310.    (set (match_operand:SI 3 "gpc_reg_operand" "=r")
  4311.     (match_operator:SI 4 "scc_comparison_operator"
  4312.                [(match_operand 5 "cc_reg_operand" "y")
  4313.                 (const_int 0)]))]
  4314.    "REGNO (operands[2]) != REGNO (operands[5])"
  4315.    "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
  4316.    [(set_attr "length" "20")])
  4317.  
  4318. ;; There are some scc insns that can be done directly, without a compare.
  4319. ;; These are faster because they don't involve the communications between
  4320. ;; the FXU and branch units.   In fact, we will be replacing all of the
  4321. ;; integer scc insns here or in the portable methods in emit_store_flag.
  4322. ;;
  4323. ;; Also support (neg (scc ..)) since that construct is used to replace
  4324. ;; branches, (plus (scc ..) ..) since that construct is common and
  4325. ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
  4326. ;; cases where it is no more expensive than (neg (scc ..)).
  4327.  
  4328. ;; Have reload force a constant into a register for the simple insns that
  4329. ;; otherwise won't accept constants.  We do this because it is faster than
  4330. ;; the cmp/mfcr sequence we would otherwise generate.
  4331.  
  4332. (define_insn ""
  4333.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
  4334.     (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
  4335.            (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
  4336.    (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
  4337.   ""
  4338.   "@
  4339.    xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
  4340.    {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
  4341.    {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
  4342.    {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
  4343.    {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
  4344.   [(set_attr "length" "12,8,12,12,12")])
  4345.  
  4346. (define_insn ""
  4347.   [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
  4348.     (compare:CC 
  4349.      (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
  4350.         (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
  4351.      (const_int 0)))
  4352.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
  4353.     (eq:SI (match_dup 1) (match_dup 2)))
  4354.    (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
  4355.   ""
  4356.   "@
  4357.    xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
  4358.    {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
  4359.    {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
  4360.    {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
  4361.    {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0"
  4362.   [(set_attr "type" "compare")
  4363.    (set_attr "length" "12,8,12,12,12")])
  4364.  
  4365. ;; We have insns of the form shown by the first define_insn below.  If
  4366. ;; there is something inside the comparison operation, we must split it.
  4367. (define_split
  4368.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  4369.     (plus:SI (match_operator 1 "comparison_operator"
  4370.                  [(match_operand:SI 2 "" "")
  4371.                   (match_operand:SI 3
  4372.                             "reg_or_cint_operand" "")])
  4373.          (match_operand:SI 4 "gpc_reg_operand" "")))
  4374.    (clobber (match_operand:SI 5 "register_operand" ""))]
  4375.   "! gpc_reg_operand (operands[2], SImode)"
  4376.   [(set (match_dup 5) (match_dup 2))
  4377.    (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
  4378.                    (match_dup 4)))])
  4379.  
  4380. (define_insn ""
  4381.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
  4382.     (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
  4383.             (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
  4384.          (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
  4385.    (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
  4386.   ""
  4387.   "@
  4388.    xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
  4389.    {sfi|subfic} %4,%1,0\;{aze|addze} %0,%3
  4390.    {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
  4391.    {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
  4392.    {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
  4393.   [(set_attr "length" "12,8,12,12,12")])
  4394.  
  4395. (define_insn ""
  4396.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
  4397.     (compare:CC 
  4398.      (plus:SI
  4399.       (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
  4400.          (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
  4401.       (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
  4402.      (const_int 0)))
  4403.    (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
  4404.   ""
  4405.   "@
  4406.    xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
  4407.    {sfi|subfic} %4,%1,0\;{aze.|addze.} %0,%3
  4408.    {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
  4409.    {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
  4410.    {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
  4411.   [(set_attr "type" "compare")
  4412.    (set_attr "length" "12,8,12,12,12")])
  4413.  
  4414. (define_insn ""
  4415.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
  4416.     (compare:CC 
  4417.      (plus:SI
  4418.       (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
  4419.          (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
  4420.       (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
  4421.      (const_int 0)))
  4422.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
  4423.     (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4424.    (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
  4425.   ""
  4426.   "@
  4427.    xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
  4428.    {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
  4429.    {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
  4430.    {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
  4431.    {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
  4432.   [(set_attr "type" "compare")
  4433.    (set_attr "length" "12,8,12,12,12")])
  4434.  
  4435. (define_insn ""
  4436.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
  4437.     (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r")
  4438.                (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
  4439.   ""
  4440.   "@
  4441.    xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
  4442.    {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
  4443.    {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
  4444.    {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
  4445.    {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
  4446.    [(set_attr "length" "12,8,12,12,12")])
  4447.  
  4448. ;; This is what (plus (ne X (const_int 0)) Y) looks like.
  4449. (define_insn ""
  4450.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4451.     (plus:SI (lshiftrt:SI
  4452.           (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
  4453.           (const_int 31))
  4454.          (match_operand:SI 2 "gpc_reg_operand" "r")))
  4455.    (clobber (match_scratch:SI 3 "=&r"))]
  4456.   ""
  4457.   "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
  4458.   [(set_attr "length" "8")])
  4459.  
  4460. (define_insn ""
  4461.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4462.     (compare:CC
  4463.      (plus:SI (lshiftrt:SI
  4464.            (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
  4465.            (const_int 31))
  4466.           (match_operand:SI 2 "gpc_reg_operand" "r"))
  4467.      (const_int 0)))
  4468.    (clobber (match_scratch:SI 3 "=&r"))]
  4469.   ""
  4470.   "{ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2"
  4471.   [(set_attr "type" "compare")
  4472.    (set_attr "length" "8")])
  4473.  
  4474. (define_insn ""
  4475.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  4476.     (compare:CC
  4477.      (plus:SI (lshiftrt:SI
  4478.            (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
  4479.            (const_int 31))
  4480.           (match_operand:SI 2 "gpc_reg_operand" "r"))
  4481.      (const_int 0)))
  4482.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4483.     (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
  4484.          (match_dup 2)))
  4485.    (clobber (match_scratch:SI 3 "=&r"))]
  4486.   ""
  4487.   "{ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2"
  4488.   [(set_attr "type" "compare")
  4489.    (set_attr "length" "8")])
  4490.  
  4491. (define_insn ""
  4492.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4493.     (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4494.            (match_operand:SI 2 "reg_or_short_operand" "r,O")))
  4495.    (clobber (match_scratch:SI 3 "=r,X"))]
  4496.   "TARGET_POWER"
  4497.   "@
  4498.    doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
  4499.    {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
  4500.   [(set_attr "length" "12")])
  4501.  
  4502. (define_insn ""
  4503.   [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
  4504.     (compare:CC
  4505.      (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4506.         (match_operand:SI 2 "reg_or_short_operand" "r,O"))
  4507.      (const_int 0)))
  4508.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4509.     (le:SI (match_dup 1) (match_dup 2)))
  4510.    (clobber (match_scratch:SI 3 "=r,X"))]
  4511.   "TARGET_POWER"
  4512.   "@
  4513.    doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
  4514.    {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31"
  4515.   [(set_attr "type" "delayed_compare,compare")
  4516.    (set_attr "length" "12")])
  4517.  
  4518. (define_insn ""
  4519.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4520.     (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4521.             (match_operand:SI 2 "reg_or_short_operand" "r,O"))
  4522.          (match_operand:SI 3 "gpc_reg_operand" "r,r")))
  4523.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4524.   "TARGET_POWER"
  4525.   "@
  4526.    doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
  4527.    {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze|addze} %0,%3"
  4528.   [(set_attr "length" "12")])
  4529.  
  4530. (define_insn ""
  4531.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  4532.     (compare:CC
  4533.      (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4534.              (match_operand:SI 2 "reg_or_short_operand" "r,O"))
  4535.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  4536.      (const_int 0)))
  4537.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4538.   "TARGET_POWER"
  4539.   "@
  4540.    doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
  4541.    {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3"
  4542.   [(set_attr "type" "compare")
  4543.    (set_attr "length" "12")])
  4544.  
  4545. (define_insn ""
  4546.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
  4547.     (compare:CC
  4548.      (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4549.              (match_operand:SI 2 "reg_or_short_operand" "r,O"))
  4550.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  4551.      (const_int 0)))
  4552.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4553.     (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4554.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4555.   "TARGET_POWER"
  4556.   "@
  4557.    doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
  4558.    {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3"
  4559.   [(set_attr "type" "compare")
  4560.    (set_attr "length" "12")])
  4561.  
  4562. (define_insn ""
  4563.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4564.     (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4565.                (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
  4566.   "TARGET_POWER"
  4567.   "@
  4568.    doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
  4569.    {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
  4570.   [(set_attr "length" "12")])
  4571.  
  4572. (define_insn ""
  4573.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4574.     (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4575.         (match_operand:SI 2 "reg_or_short_operand" "rI")))]
  4576.   ""
  4577.   "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
  4578.   [(set_attr "length" "12")])
  4579.  
  4580. (define_insn ""
  4581.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  4582.     (compare:CC
  4583.      (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4584.          (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4585.      (const_int 0)))
  4586.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4587.     (leu:SI (match_dup 1) (match_dup 2)))]
  4588.    ""
  4589.   "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
  4590.   [(set_attr "type" "compare")
  4591.    (set_attr "length" "12")])
  4592.  
  4593. (define_insn ""
  4594.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4595.     (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4596.              (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4597.          (match_operand:SI 3 "gpc_reg_operand" "r")))
  4598.    (clobber (match_scratch:SI 4 "=&r"))]
  4599.   ""
  4600.   "{sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %0,%3"
  4601.   [(set_attr "length" "8")])
  4602.  
  4603. (define_insn ""
  4604.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4605.     (compare:CC
  4606.      (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4607.               (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4608.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  4609.      (const_int 0)))
  4610.    (clobber (match_scratch:SI 4 "=&r"))]
  4611.   ""
  4612.   "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3"
  4613.   [(set_attr "type" "compare")
  4614.    (set_attr "length" "8")])
  4615.  
  4616. (define_insn ""
  4617.   [(set (match_operand:CC 5 "cc_reg_operand" "=x")
  4618.     (compare:CC
  4619.      (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4620.               (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4621.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  4622.      (const_int 0)))
  4623.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4624.     (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4625.    (clobber (match_scratch:SI 4 "=&r"))]
  4626.   ""
  4627.   "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %0,%3"
  4628.   [(set_attr "type" "compare")
  4629.    (set_attr "length" "8")])
  4630.  
  4631. (define_insn ""
  4632.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4633.     (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4634.             (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
  4635.   ""
  4636.   "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
  4637.    [(set_attr "length" "12")])
  4638.  
  4639. (define_insn ""
  4640.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4641.     (and:SI (neg:SI
  4642.          (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4643.              (match_operand:SI 2 "reg_or_short_operand" "rI")))
  4644.         (match_operand:SI 3 "gpc_reg_operand" "r")))
  4645.    (clobber (match_scratch:SI 4 "=&r"))]
  4646.   ""
  4647.   "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
  4648.   [(set_attr "length" "12")])
  4649.  
  4650. (define_insn ""
  4651.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4652.     (compare:CC
  4653.      (and:SI (neg:SI
  4654.           (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4655.               (match_operand:SI 2 "reg_or_short_operand" "rI")))
  4656.          (match_operand:SI 3 "gpc_reg_operand" "r"))
  4657.      (const_int 0)))
  4658.    (clobber (match_scratch:SI 4 "=&r"))]
  4659.   ""
  4660.   "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
  4661.   [(set_attr "type" "compare")
  4662.    (set_attr "length" "12")])
  4663.  
  4664. (define_insn ""
  4665.   [(set (match_operand:CC 5 "cc_reg_operand" "=x")
  4666.     (compare:CC
  4667.      (and:SI (neg:SI
  4668.           (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4669.               (match_operand:SI 2 "reg_or_short_operand" "rI")))
  4670.          (match_operand:SI 3 "gpc_reg_operand" "r"))
  4671.      (const_int 0)))
  4672.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4673.     (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
  4674.    (clobber (match_scratch:SI 4 "=&r"))]
  4675.   ""
  4676.   "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
  4677.   [(set_attr "type" "compare")
  4678.    (set_attr "length" "12")])
  4679.  
  4680. (define_insn ""
  4681.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4682.     (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4683.            (match_operand:SI 2 "reg_or_short_operand" "rI")))]
  4684.   "TARGET_POWER"
  4685.   "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
  4686.    [(set_attr "length" "12")])
  4687.  
  4688. (define_insn ""
  4689.   [(set (match_operand:SI 3 "cc_reg_operand" "=x")
  4690.     (compare:CC
  4691.      (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4692.         (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4693.      (const_int 0)))
  4694.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4695.     (lt:SI (match_dup 1) (match_dup 2)))]
  4696.   "TARGET_POWER"
  4697.   "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
  4698.   [(set_attr "type" "delayed_compare")
  4699.    (set_attr "length" "12")])
  4700.  
  4701. (define_insn ""
  4702.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4703.     (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4704.             (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4705.          (match_operand:SI 3 "gpc_reg_operand" "r")))
  4706.    (clobber (match_scratch:SI 4 "=&r"))]
  4707.   "TARGET_POWER"
  4708.   "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
  4709.   [(set_attr "length" "12")])
  4710.  
  4711. (define_insn ""
  4712.   [(set (match_operand:SI 0 "cc_reg_operand" "=x")
  4713.     (compare:CC
  4714.      (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4715.              (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4716.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  4717.      (const_int 0)))
  4718.    (clobber (match_scratch:SI 4 "=&r"))]
  4719.   "TARGET_POWER"
  4720.   "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
  4721.   [(set_attr "type" "compare")
  4722.    (set_attr "length" "12")])
  4723.  
  4724. (define_insn ""
  4725.   [(set (match_operand:SI 5 "cc_reg_operand" "=x")
  4726.     (compare:CC
  4727.      (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4728.              (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4729.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  4730.      (const_int 0)))
  4731.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4732.     (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4733.    (clobber (match_scratch:SI 4 "=&r"))]
  4734.   "TARGET_POWER"
  4735.   "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
  4736.   [(set_attr "type" "compare")
  4737.    (set_attr "length" "12")])
  4738.  
  4739. (define_insn ""
  4740.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4741.     (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4742.                (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
  4743.   "TARGET_POWER"
  4744.   "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
  4745.   [(set_attr "length" "12")])
  4746.  
  4747. (define_insn ""
  4748.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4749.     (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4750.         (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
  4751.   ""
  4752.   "@
  4753.    {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
  4754.    {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
  4755.   [(set_attr "length" "12")])
  4756.  
  4757. (define_insn ""
  4758.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
  4759.     (compare:CC
  4760.      (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4761.          (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4762.      (const_int 0)))
  4763.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4764.     (ltu:SI (match_dup 1) (match_dup 2)))]
  4765.   ""
  4766.   "@
  4767.    {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
  4768.    {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
  4769.   [(set_attr "type" "compare")
  4770.    (set_attr "length" "12")])
  4771.  
  4772. (define_insn ""
  4773.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
  4774.     (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
  4775.              (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
  4776.          (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
  4777.    (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
  4778.   ""
  4779.   "@
  4780.   {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
  4781.   {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
  4782.   {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
  4783.   {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
  4784.  [(set_attr "length" "12")])
  4785.  
  4786. (define_insn ""
  4787.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  4788.     (compare:CC
  4789.      (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4790.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4791.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  4792.      (const_int 0)))
  4793.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4794.   ""
  4795.   "@
  4796.    {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
  4797.    {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3"
  4798.   [(set_attr "type" "compare")
  4799.    (set_attr "length" "12")])
  4800.  
  4801. (define_insn ""
  4802.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
  4803.     (compare:CC
  4804.      (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4805.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4806.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  4807.      (const_int 0)))
  4808.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4809.     (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4810.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4811.   ""
  4812.   "@
  4813.    {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
  4814.    {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
  4815.   [(set_attr "type" "compare")
  4816.    (set_attr "length" "12")])
  4817.  
  4818. (define_insn ""
  4819.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4820.     (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4821.             (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
  4822.   ""
  4823.   "@
  4824.    {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
  4825.    {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
  4826.   [(set_attr "length" "8")])
  4827.  
  4828. (define_insn ""
  4829.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4830.     (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4831.            (match_operand:SI 2 "reg_or_short_operand" "rI")))
  4832.    (clobber (match_scratch:SI 3 "=r"))]
  4833.   "TARGET_POWER"
  4834.   "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
  4835.    [(set_attr "length" "12")])
  4836.  
  4837. (define_insn ""
  4838.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  4839.     (compare:CC
  4840.      (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4841.         (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4842.      (const_int 0)))
  4843.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4844.     (ge:SI (match_dup 1) (match_dup 2)))
  4845.    (clobber (match_scratch:SI 3 "=r"))]
  4846.   "TARGET_POWER"
  4847.   "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3"
  4848.   [(set_attr "type" "compare")
  4849.    (set_attr "length" "12")])
  4850.  
  4851. (define_insn ""
  4852.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4853.     (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4854.             (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4855.          (match_operand:SI 3 "gpc_reg_operand" "r")))
  4856.    (clobber (match_scratch:SI 4 "=&r"))]
  4857.   "TARGET_POWER"
  4858.   "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
  4859.   [(set_attr "length" "12")])
  4860.  
  4861. (define_insn ""
  4862.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4863.     (compare:CC
  4864.      (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4865.              (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4866.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  4867.      (const_int 0)))
  4868.    (clobber (match_scratch:SI 4 "=&r"))]
  4869.   "TARGET_POWER"
  4870.   "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
  4871.   [(set_attr "type" "compare")
  4872.    (set_attr "length" "12")])
  4873.  
  4874. (define_insn ""
  4875.   [(set (match_operand:CC 5 "cc_reg_operand" "=x")
  4876.     (compare:CC
  4877.      (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4878.              (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4879.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  4880.      (const_int 0)))
  4881.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4882.     (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4883.    (clobber (match_scratch:SI 4 "=&r"))]
  4884.   "TARGET_POWER"
  4885.   "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
  4886.   [(set_attr "type" "compare")
  4887.    (set_attr "length" "12")])
  4888.  
  4889. (define_insn ""
  4890.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4891.     (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4892.                (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
  4893.   "TARGET_POWER"
  4894.   "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
  4895.   [(set_attr "length" "12")])
  4896.  
  4897. ;; This is (and (neg (ge X (const_int 0))) Y).
  4898. (define_insn ""
  4899.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4900.     (and:SI (neg:SI
  4901.          (lshiftrt:SI
  4902.           (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  4903.           (const_int 31)))
  4904.         (match_operand:SI 2 "gpc_reg_operand" "r")))
  4905.    (clobber (match_scratch:SI 3 "=&r"))]
  4906.   ""
  4907.   "{srai|srawi} %3,%1,31\;andc %0,%2,%3"
  4908.   [(set_attr "length" "8")])
  4909.  
  4910. (define_insn ""
  4911.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4912.     (compare:CC
  4913.      (and:SI (neg:SI
  4914.           (lshiftrt:SI
  4915.            (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  4916.            (const_int 31)))
  4917.          (match_operand:SI 2 "gpc_reg_operand" "r"))
  4918.      (const_int 0)))
  4919.    (clobber (match_scratch:SI 3 "=&r"))]
  4920.   ""
  4921.   "{srai|srawi} %3,%1,31\;andc. %3,%2,%3"
  4922.   [(set_attr "type" "compare")
  4923.    (set_attr "length" "8")])
  4924.  
  4925. (define_insn ""
  4926.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  4927.     (compare:CC
  4928.      (and:SI (neg:SI
  4929.           (lshiftrt:SI
  4930.            (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  4931.            (const_int 31)))
  4932.          (match_operand:SI 2 "gpc_reg_operand" "r"))
  4933.      (const_int 0)))
  4934.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4935.     (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
  4936.                      (const_int 31)))
  4937.         (match_dup 2)))
  4938.    (clobber (match_scratch:SI 3 "=&r"))]
  4939.   ""
  4940.   "{srai|srawi} %3,%1,31\;andc. %0,%2,%3"
  4941.   [(set_attr "type" "compare")
  4942.    (set_attr "length" "8")])
  4943.  
  4944. (define_insn ""
  4945.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4946.     (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4947.         (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
  4948.   ""
  4949.   "@
  4950.    {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
  4951.    {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
  4952.   [(set_attr "length" "12")])
  4953.  
  4954. (define_insn ""
  4955.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
  4956.     (compare:CC
  4957.      (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4958.          (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4959.      (const_int 0)))
  4960.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4961.     (geu:SI (match_dup 1) (match_dup 2)))]
  4962.   ""
  4963.   "@
  4964.    {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
  4965.    {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
  4966.   [(set_attr "type" "compare")
  4967.    (set_attr "length" "12")])
  4968.  
  4969. (define_insn ""
  4970.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4971.     (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4972.              (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4973.          (match_operand:SI 3 "gpc_reg_operand" "r,r")))
  4974.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4975.   ""
  4976.   "@
  4977.    {sf|subfc} %4,%2,%1\;{aze|addze} %0,%3
  4978.    {ai|addic} %4,%1,%n2\;{aze|addze} %0,%3"
  4979.   [(set_attr "length" "8")])
  4980.  
  4981. (define_insn ""
  4982.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  4983.     (compare:CC
  4984.      (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4985.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4986.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  4987.      (const_int 0)))
  4988.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4989.   ""
  4990.   "@
  4991.    {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
  4992.    {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
  4993.   [(set_attr "type" "compare")
  4994.    (set_attr "length" "8")])
  4995.  
  4996. (define_insn ""
  4997.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
  4998.     (compare:CC
  4999.      (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  5000.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  5001.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  5002.      (const_int 0)))
  5003.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  5004.     (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  5005.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  5006.   ""
  5007.   "@
  5008.    {sf|subfc} %4,%2,%1\;{aze.|addze.} %0,%3
  5009.    {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
  5010.   [(set_attr "type" "compare")
  5011.    (set_attr "length" "8")])
  5012.  
  5013. (define_insn ""
  5014.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  5015.     (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  5016.             (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
  5017.   ""
  5018.   "@
  5019.    {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
  5020.    {sfi|subfic} %0,%1,-1\;a%I2 %0,%0,%2\;{sfe|subfe} %0,%0,%0"
  5021.   [(set_attr "length" "12")])
  5022.  
  5023. (define_insn ""
  5024.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  5025.     (and:SI (neg:SI
  5026.          (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  5027.              (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
  5028.         (match_operand:SI 3 "gpc_reg_operand" "r,r")))
  5029.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  5030.   ""
  5031.   "@
  5032.    {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4
  5033.    {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
  5034.   [(set_attr "length" "12")])
  5035.  
  5036. (define_insn ""
  5037.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  5038.     (compare:CC
  5039.      (and:SI (neg:SI
  5040.           (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  5041.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
  5042.          (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  5043.      (const_int 0)))
  5044.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  5045.   ""
  5046.   "@
  5047.    {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
  5048.    {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
  5049.   [(set_attr "type" "compare")
  5050.    (set_attr "length" "12")])
  5051.  
  5052. (define_insn ""
  5053.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
  5054.     (compare:CC
  5055.      (and:SI (neg:SI
  5056.           (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  5057.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
  5058.          (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  5059.      (const_int 0)))
  5060.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  5061.     (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
  5062.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  5063.   ""
  5064.   "@
  5065.    {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
  5066.    {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
  5067.   [(set_attr "type" "compare")
  5068.    (set_attr "length" "12")])
  5069.  
  5070. (define_insn ""
  5071.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5072.     (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5073.            (const_int 0)))]
  5074.   ""
  5075.   "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
  5076.   [(set_attr "length" "12")])
  5077.  
  5078. (define_insn ""
  5079.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  5080.     (compare:CC
  5081.      (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5082.         (const_int 0))
  5083.      (const_int 0)))
  5084.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5085.     (gt:SI (match_dup 1) (const_int 0)))]
  5086.   ""
  5087.   "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31"
  5088.   [(set_attr "type" "delayed_compare")
  5089.    (set_attr "length" "12")])
  5090.  
  5091. (define_insn ""
  5092.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5093.     (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5094.            (match_operand:SI 2 "reg_or_short_operand" "r")))]
  5095.   "TARGET_POWER"
  5096.   "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
  5097.   [(set_attr "length" "12")])
  5098.  
  5099. (define_insn ""
  5100.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  5101.     (compare:CC
  5102.      (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5103.         (match_operand:SI 2 "reg_or_short_operand" "r"))
  5104.      (const_int 0)))
  5105.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5106.     (gt:SI (match_dup 1) (match_dup 2)))]
  5107.   "TARGET_POWER"
  5108.   "doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
  5109.   [(set_attr "type" "delayed_compare")
  5110.    (set_attr "length" "12")])
  5111.  
  5112. (define_insn ""
  5113.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5114.     (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5115.             (const_int 0))
  5116.          (match_operand:SI 2 "gpc_reg_operand" "r")))
  5117.    (clobber (match_scratch:SI 3 "=&r"))]
  5118.   ""
  5119.   "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %0,%2"
  5120.   [(set_attr "length" "12")])
  5121.  
  5122. (define_insn ""
  5123.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  5124.     (compare:CC
  5125.      (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5126.              (const_int 0))
  5127.           (match_operand:SI 2 "gpc_reg_operand" "r"))
  5128.      (const_int 0)))
  5129.    (clobber (match_scratch:SI 3 "=&r"))]
  5130.   ""
  5131.   "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %0,%2"
  5132.   [(set_attr "type" "compare")
  5133.    (set_attr "length" "12")])
  5134.  
  5135. (define_insn ""
  5136.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  5137.     (compare:CC
  5138.      (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5139.              (const_int 0))
  5140.           (match_operand:SI 2 "gpc_reg_operand" "r"))
  5141.      (const_int 0)))
  5142.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5143.     (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
  5144.    (clobber (match_scratch:SI 3 "=&r"))]
  5145.   ""
  5146.   "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2"
  5147.   [(set_attr "type" "compare")
  5148.    (set_attr "length" "12")])
  5149.  
  5150. (define_insn ""
  5151.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5152.     (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5153.             (match_operand:SI 2 "reg_or_short_operand" "r"))
  5154.          (match_operand:SI 3 "gpc_reg_operand" "r")))
  5155.    (clobber (match_scratch:SI 4 "=&r"))]
  5156.   "TARGET_POWER"
  5157.   "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
  5158.   [(set_attr "length" "12")])
  5159.  
  5160. (define_insn ""
  5161.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  5162.     (compare:CC
  5163.      (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5164.              (match_operand:SI 2 "reg_or_short_operand" "r"))
  5165.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  5166.      (const_int 0)))
  5167.    (clobber (match_scratch:SI 4 "=&r"))]
  5168.   "TARGET_POWER"
  5169.   "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
  5170.   [(set_attr "type" "compare")
  5171.    (set_attr "length" "12")])
  5172.  
  5173. (define_insn ""
  5174.   [(set (match_operand:CC 5 "cc_reg_operand" "=x")
  5175.     (compare:CC
  5176.      (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5177.              (match_operand:SI 2 "reg_or_short_operand" "r"))
  5178.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  5179.      (const_int 0)))
  5180.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5181.     (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  5182.    (clobber (match_scratch:SI 4 "=&r"))]
  5183.   "TARGET_POWER"
  5184.   "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
  5185.   [(set_attr "type" "compare")
  5186.    (set_attr "length" "12")])
  5187.  
  5188. (define_insn ""
  5189.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5190.     (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5191.                (const_int 0))))]
  5192.   ""
  5193.   "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
  5194.   [(set_attr "length" "12")])
  5195.  
  5196. (define_insn ""
  5197.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5198.     (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5199.                (match_operand:SI 2 "reg_or_short_operand" "r"))))]
  5200.   "TARGET_POWER"
  5201.   "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
  5202.   [(set_attr "length" "12")])
  5203.  
  5204. (define_insn ""
  5205.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5206.     (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5207.         (match_operand:SI 2 "reg_or_short_operand" "rI")))]
  5208.   ""
  5209.   "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
  5210.   [(set_attr "length" "12")])
  5211.  
  5212. (define_insn ""
  5213.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  5214.     (compare:CC
  5215.      (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5216.          (match_operand:SI 2 "reg_or_short_operand" "rI"))
  5217.      (const_int 0)))
  5218.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5219.     (gtu:SI (match_dup 1) (match_dup 2)))]
  5220.   ""
  5221.   "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
  5222.   [(set_attr "type" "compare")
  5223.    (set_attr "length" "12")])
  5224.  
  5225. (define_insn ""
  5226.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
  5227.     (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
  5228.              (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
  5229.          (match_operand:SI 3 "reg_or_short_operand" "r,r,I")))
  5230.    (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
  5231.   ""
  5232.   "@
  5233.    {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3
  5234.    {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
  5235.    {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
  5236.   [(set_attr "length" "8,12,12")])
  5237.  
  5238. (define_insn ""
  5239.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  5240.     (compare:CC
  5241.      (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  5242.               (match_operand:SI 2 "reg_or_short_operand" "I,r"))
  5243.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  5244.      (const_int 0)))
  5245.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  5246.   ""
  5247.   "@
  5248.    {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
  5249.    {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
  5250.   [(set_attr "type" "compare")
  5251.    (set_attr "length" "8,12")])
  5252.  
  5253. (define_insn ""
  5254.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
  5255.     (compare:CC
  5256.      (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  5257.               (match_operand:SI 2 "reg_or_short_operand" "I,r"))
  5258.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  5259.      (const_int 0)))
  5260.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  5261.     (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  5262.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  5263.   ""
  5264.   "@
  5265.    {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
  5266.    {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
  5267.   [(set_attr "type" "compare")
  5268.    (set_attr "length" "8,12")])
  5269.  
  5270. (define_insn ""
  5271.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  5272.     (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  5273.             (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
  5274.   ""
  5275.   "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
  5276.   [(set_attr "length" "8")])
  5277.  
  5278. ;; Define both directions of branch and return.  If we need a reload
  5279. ;; register, we'd rather use CR0 since it is much easier to copy a
  5280. ;; register CC value to there.
  5281.  
  5282. (define_insn ""
  5283.   [(set (pc)
  5284.     (if_then_else (match_operator 1 "branch_comparison_operator"
  5285.                       [(match_operand 2
  5286.                               "cc_reg_operand" "x,?y")
  5287.                        (const_int 0)])
  5288.               (label_ref (match_operand 0 "" ""))
  5289.               (pc)))]
  5290.   ""
  5291.   "*
  5292. {
  5293.   if (get_attr_length (insn) == 8)
  5294.     return \"%C1bc %t1,%j1,%l0\";
  5295.   else
  5296.     return \"%C1bc %T1,%j1,$+8\;b %l0\";
  5297. }"
  5298.   [(set_attr "type" "branch")])
  5299.  
  5300.  
  5301. (define_insn ""
  5302.   [(set (pc)
  5303.     (if_then_else (match_operator 0 "branch_comparison_operator"
  5304.                       [(match_operand 1
  5305.                               "cc_reg_operand" "x,?y")
  5306.                        (const_int 0)])
  5307.               (return)
  5308.               (pc)))]
  5309.   "direct_return ()"
  5310.   "{%C0bcr|%C0bclr} %t0,%j0"
  5311.   [(set_attr "length" "8")])
  5312.  
  5313. (define_insn ""
  5314.   [(set (pc)
  5315.     (if_then_else (match_operator 1 "branch_comparison_operator"
  5316.                       [(match_operand 2
  5317.                               "cc_reg_operand" "x,?y")
  5318.                        (const_int 0)])
  5319.               (pc)
  5320.               (label_ref (match_operand 0 "" ""))))]
  5321.   ""
  5322.   "*
  5323. {
  5324.   if (get_attr_length (insn) == 8)
  5325.     return \"%C1bc %T1,%j1,%l0\";
  5326.   else
  5327.     return \"%C1bc %t1,%j1,$+8\;b %l0\";
  5328. }"
  5329.   [(set_attr "type" "branch")])
  5330.  
  5331. (define_insn ""
  5332.   [(set (pc)
  5333.     (if_then_else (match_operator 0 "branch_comparison_operator"
  5334.                       [(match_operand 1
  5335.                               "cc_reg_operand" "x,?y")
  5336.                        (const_int 0)])
  5337.               (pc)
  5338.               (return)))]
  5339.   "direct_return ()"
  5340.   "{%C0bcr|%C0bclr} %T0,%j0"
  5341.   [(set_attr "length" "8")])
  5342.  
  5343. ;; Unconditional branch and return.
  5344.  
  5345. (define_insn "jump"
  5346.   [(set (pc)
  5347.     (label_ref (match_operand 0 "" "")))]
  5348.   ""
  5349.   "b %l0")
  5350.  
  5351. (define_insn "return"
  5352.   [(return)]
  5353.   "direct_return ()"
  5354.   "{br|blr}")
  5355.  
  5356. (define_insn "indirect_jump"
  5357.   [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
  5358.   ""
  5359.   "@
  5360.    bctr
  5361.    {br|blr}")
  5362.  
  5363. ;; Table jump for switch statements:
  5364. (define_expand "tablejump"
  5365.   [(set (match_dup 3)
  5366.     (plus:SI (match_operand:SI 0 "" "")
  5367.          (match_dup 2)))
  5368.    (parallel [(set (pc) (match_dup 3))
  5369.           (use (label_ref (match_operand 1 "" "")))])]
  5370.   ""
  5371.   "
  5372. { operands[0] = force_reg (SImode, operands[0]);
  5373.   operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
  5374.   operands[3] = gen_reg_rtx (SImode);
  5375. }")
  5376.  
  5377. (define_insn ""
  5378.   [(set (pc)
  5379.     (match_operand:SI 0 "register_operand" "c,l"))
  5380.    (use (label_ref (match_operand 1 "" "")))]
  5381.   ""
  5382.   "@
  5383.    bctr
  5384.    {br|blr}")
  5385.  
  5386. (define_insn "nop"
  5387.   [(const_int 0)]
  5388.   ""
  5389.   "{cror 0,0,0|nop}")
  5390.  
  5391. ;; Define the subtract-one-and-jump insns, starting with the template 
  5392. ;; so loop.c knows what to generate.
  5393.  
  5394. (define_expand "decrement_and_branchsi"
  5395.   [(parallel [(set (pc) (if_then_else (ne (match_operand:SI 0 "register_operand" "c")
  5396.                       (const_int 1))
  5397.                       (label_ref (match_operand 1 "" ""))
  5398.                       (pc)))
  5399.           (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))])]
  5400.   ""
  5401.   "")
  5402.  
  5403. ;; We need to be able to do this for any operand, including MEM, or we
  5404. ;; will cause reload to blow up since we don't allow output reloads on
  5405. ;; JUMP_INSNs. 
  5406. (define_insn ""
  5407.   [(set (pc)
  5408.     (if_then_else (ne (match_operand:SI 1 "register_operand" "0,*r,*r")
  5409.               (const_int 1))
  5410.               (label_ref (match_operand 2 "" ""))
  5411.               (pc)))
  5412.    (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
  5413.     (plus:SI (match_dup 1) (const_int -1)))
  5414.    (clobber (match_scratch:CC 3 "=X,&x,&x"))
  5415.    (clobber (match_scratch:SI 4 "=X,X,r"))]
  5416.   ""
  5417.   "*
  5418. {
  5419.   if (which_alternative != 0)
  5420.     return \"#\";
  5421.   else if (get_attr_length (insn) == 8)
  5422.     return \"{bdn|bdnz} %l2\";
  5423.   else
  5424.     return \"bdz $+8\;b %l2\";
  5425. }"
  5426.   [(set_attr "type" "branch")
  5427.    (set_attr "length" "*,12,16")])
  5428.                    
  5429. ;; Similar, but we can use GE since we have a REG_NONNEG.
  5430. (define_insn ""
  5431.   [(set (pc)
  5432.     (if_then_else (ge (match_operand:SI 1 "register_operand" "0,*r,*r")
  5433.               (const_int 0))
  5434.               (label_ref (match_operand 2 "" ""))
  5435.               (pc)))
  5436.    (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
  5437.     (plus:SI (match_dup 1) (const_int -1)))
  5438.    (clobber (match_scratch:CC 3 "=X,&x,&X"))
  5439.    (clobber (match_scratch:SI 4 "=X,X,r"))]
  5440.   "find_reg_note (insn, REG_NONNEG, 0)"
  5441.   "*
  5442. {
  5443.   if (which_alternative != 0)
  5444.     return \"#\";
  5445.   else if (get_attr_length (insn) == 8)
  5446.     return \"{bdn|bdnz} %l2\";
  5447.   else
  5448.     return \"bdz $+8\;b %l2\";
  5449. }"
  5450.   [(set_attr "type" "branch")
  5451.    (set_attr "length" "*,12,16")])
  5452.                    
  5453. (define_insn ""
  5454.   [(set (pc)
  5455.     (if_then_else (eq (match_operand:SI 1 "register_operand" "0,*r,*r")
  5456.               (const_int 1))
  5457.               (label_ref (match_operand 2 "" ""))
  5458.               (pc)))
  5459.    (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
  5460.     (plus:SI (match_dup 1) (const_int -1)))
  5461.    (clobber (match_scratch:CC 3 "=X,&x,&x"))
  5462.    (clobber (match_scratch:SI 4 "=X,X,r"))]
  5463.   ""
  5464.   "*
  5465. {
  5466.   if (which_alternative != 0)
  5467.     return \"#\";
  5468.   else if (get_attr_length (insn) == 8)
  5469.     return \"bdz %l2\";
  5470.   else
  5471.     return \"{bdn|bdnz} $+8\;b %l2\";
  5472. }"
  5473.   [(set_attr "type" "branch")
  5474.    (set_attr "length" "*,12,16")])
  5475.  
  5476. (define_split
  5477.   [(set (pc)
  5478.     (if_then_else (match_operator 2 "comparison_operator"
  5479.                       [(match_operand:SI 1 "gpc_reg_operand" "")
  5480.                        (const_int 1)])
  5481.               (match_operand 5 "" "")
  5482.               (match_operand 6 "" "")))
  5483.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  5484.     (plus:SI (match_dup 1) (const_int -1)))
  5485.    (clobber (match_scratch:CC 3 ""))
  5486.    (clobber (match_scratch:SI 4 ""))]
  5487.   "reload_completed"
  5488.   [(parallel [(set (match_dup 3)
  5489.            (compare:CC (plus:SI (match_dup 1) (const_int -1))
  5490.                    (const_int 0)))
  5491.           (set (match_dup 0) (plus:SI (match_dup 1) (const_int -1)))])
  5492.    (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))]
  5493.   "
  5494. { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
  5495.              const0_rtx); }")
  5496.  
  5497. (define_split
  5498.   [(set (pc)
  5499.     (if_then_else (match_operator 2 "comparison_operator"
  5500.                       [(match_operand:SI 1 "gpc_reg_operand" "")
  5501.                        (const_int 1)])
  5502.               (match_operand 5 "" "")
  5503.               (match_operand 6 "" "")))
  5504.    (set (match_operand:SI 0 "general_operand" "")
  5505.     (plus:SI (match_dup 1) (const_int -1)))
  5506.    (clobber (match_scratch:CC 3 ""))
  5507.    (clobber (match_scratch:SI 4 ""))]
  5508.   "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
  5509.   [(parallel [(set (match_dup 3)
  5510.            (compare:CC (plus:SI (match_dup 1) (const_int -1))
  5511.                    (const_int 0)))
  5512.           (set (match_dup 4) (plus:SI (match_dup 1) (const_int -1)))])
  5513.    (set (match_dup 0) (match_dup 4))
  5514.    (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))]
  5515.   "
  5516. { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
  5517.              const0_rtx); }")
  5518.